Installing Smarty in a non-default location

Are you just starting out with the Smarty template language? Are you trying to install it some place other than in '/usr/local/lib/Smarty-xxxx'? If so and you are having problems, you are not alone.

I wanted to install Smarty some place other than the default location, actually I wanted to install it below my web root in a directory named 'library'. Looking at Example 2.5 on the Smarty Basic Installation page, I tried the following code:


ini_set('include_path', ini_get('include_path') . PATH_SEPARATOR . '/library/Smarty-2.6.18/libs/');

But that did not work I kept getting an error and after a little playing around I realized I needed to use the '$_SERVER[DOCUMENT_ROOT]' super global, like the following:


ini_set('include_path', ini_get('include_path') . PATH_SEPARATOR . $_SERVER['DOCUMENT_ROOT'] . '/library/Smarty-2.6.18/libs/');

And viola, it works!

User login

Contacting Rob

Y! roberthenrylowe
AIM roberthenrylowe
ICQ 249971225
email rhlowe [at] gmail dot com

Networking Links