Skip to content

Instantly share code, notes, and snippets.

@erikreagan
erikreagan / ExpressionEngine Body Tags
Created October 5, 2009 12:59
ExpressionEngine Body Tags
<!-- A few samples of body tag use in ExpressionEngine templates -->
<!-- This uses embedded variables if they are sent from another template. I use this one often -->
<body{if embed:body_id} id="{embed:body_id}"{/if}{if embed:body_class} class="{embed:body_class}"{/if}>
<!-- This works well when sticking to the template_group/template structure -->
<body{if segment_1 !=''} id="{segment_1}"{if segment_2 != ''} class="{segment_2}"{/if}{/if}>
@erikreagan
erikreagan / tm-serialization-command1.php
Created October 27, 2009 21:28
Work with serialized data easier
#!/usr/bin/env php
<?php
// This command simply prints out the serialized data in a readable printed array format
// Found on a blog via a google search
// @see http://top-frog.com/2009/08/28/quickly-unserialize-data-in-textmate/
$data = unserialize(file_get_contents('php://stdin'));
print_r($data);
@choonkeat
choonkeat / ee-localize-mysqldump.rb
Created November 26, 2009 02:05
Because customizing config.php is insufficient (3rd party code get left out, config.php get overwritten on update, ...) http://boblet.tumblr.com/post/68095239/ee-localhost
#!/bin/env ruby
if ARGV.empty?
$stderr.puts <<-EOM
ExpressionEngine (1.x) MYSQL DUMP Localizer
1. Reads MYSQL DUMP of ExpressionEngine website from STDIN
2. Replaces ALL HOSTNAME & PATH data (config) with LOCAL SETTINGS
3. Output corrected MYSQL DYMP file.
@masugadesign
masugadesign / .bash_profile prompt (remote server, Git branch)
Created February 15, 2010 17:49
.bash_profile prompt (remote server, Git branch)
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
# non git dir: [email protected]:~/var/www: _
# in git dir: [email protected]:~/var/www/site.tld (branchname): _
PS1="\[\e[01;31m\]\u@\H:\w\$(parse_git_branch): \[\e[00m\]"
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
{if segment_1 == "search" && segment_2 != ""}
<script type="text/javascript">
try {
var pageTracker = _gat._getTracker("UA-000000-1");
pageTracker._initData();
<?php
/**
* Custom configuration bootstrap file for ExpressionEngine
*
* Place config.php in your site root
* Add require(realpath(dirname(__FILE__) . '/../../config_bootstrap.php')); to the bottom of system/expressionengine/config/config.php
* Add require(realpath(dirname(__FILE__) . '/../../config_bootstrap.php')); to the bottom of system/expressionengine/config/database.php
* If you have moved your site root you'll need to update the require_once path
*
<?php
// Dynamic paths for cross-server compatibility
$protocol = (isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == "on") ? "https://" : "http://";
$base_url = $protocol . $_SERVER['HTTP_HOST'];
$base_path = $_SERVER['DOCUMENT_ROOT'];
$system_folder = "system";
$images_folder = "images";
$images_path = $base_path . "/" . $images_folder;
<?php
// Dynamic paths for cross-server compatibility
$protocol = (isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == "on") ? "https://" : "http://";
$base_url = $protocol . $_SERVER['HTTP_HOST'];
$base_path = $_SERVER['DOCUMENT_ROOT'];
$system_folder = "system";
$images_folder = "images";
$images_path = $base_path . "/" . $images_folder;
<?php
// Debugging and performance
$config['show_profiler'] = 'n'; # y/n
$config['template_debugging'] = 'n'; # y/n
$config['debug'] = '1'; # 0: no PHP/SQL errors shown. 1: Errors shown to Super Admins. 2: Errors shown to everyone.
$config['disable_all_tracking'] = 'y'; # y/n
$config['enable_sql_caching'] = 'n'; # Cache Dynamic Channel Queries?
$config['email_debug'] = 'n'; # y/n
<?php
/*
EE2 hidden configuration variables
Last updated: Jun 20 2010
Obtain this list by putting print_r($this->EE->config->config); on a PHP-enabled template.
See: http://eeinsider.com/tips/view/config-overrides-for-ee-1-and-2/
*/