x
 
Create New Page

Revision: Per Site Config

Revision from: 15:42, 22 Jun 2010

Changes are made at your own risk and are not guaranteed to work. Always make backups of the database and files prior to implementing hacks. Make a special backup of the file and/or template you are modifying so that you can roll back quickly.

Hacks are dangerous and can cause your site to stop working. They make later updates to ExpressionEngine more difficult; you should track your hacks for post-update re-implementation. 

Most hacks are unnecessary, please review the Development Documentation for information on expanding ExpressionEngine via Modules, Extensions, and Plugins.

Hacks are never officially supported.

The options in config.php are global, but a hack allows you to specify them per-site.

Assume that you want to change the Member Profile Theme and Emoticon options for a site. First, you must open config.php and find the names for those options. In this case, those options are

$conf['member_theme'"default"
... 
$conf['enable_emoticons'"n"
$conf['emoticon_path'"http://www.yoursite.com/ee/images/smileys/"

So we have ‘member_theme’, ‘enable_emoticons’, and ‘emoticon_path’.

Now open up system/core/core.system.php and find this block of comments:


// These are configuration exceptions. In some cases a user might want

// to manually override a config file setting by adding a variable in

// the index.php or path.php file. This loop permits this to happen.

Beneath that, you’ll see an array being set. Edit this array, adding the options we just found. In our example, it might look like this:

$config_exceptions = array('site_url''site_index''site_404'
'template_group''template''enable_emoticons''emoticon_path'
'member_theme'); 

This tells EE that path.php should trump config.php with these variables.

Now open path.php, and set those variables’ values. DO NOT use $conf[‘option_name’]; just use $option_name. So our path.php might look like this:

$template_group "whatever"
$template "index"
$site_url "http://whatever.com"
$member_theme "default"
$enable_emoticons "y"
$emoticon_path "http://whatever.com/images/smileys/"

And you’re done!

As always, back up your files before you do this. Specifically, back up core.system.php, config.php, and path.php. And if you want to be REALLY smart, back up your database too.

Category:Hacks Category:Tricks

Category:EE1

Categories: