开发者

Please help with smarty template error

I just moved my website to another server and i got this error message using smarty template

http://bit.ly/5MZu2A

Here is part of the smarty file:

/**
 * DIR_SEP isn't 开发者_C百科used anymore, but third party apps might
 */
if(!defined('DIR_SEP')) {
    define('DIR_SEP', DIRECTORY_SEPARATOR);
}

/**
 * set SMARTY_DIR to absolute path to Smarty library files.
 * if not defined, include_path will be used. Sets SMARTY_DIR only if user
 * application has not already defined it.
 */

if (!defined('SMARTY_DIR')) {
    define('SMARTY_DIR', dirname(__FILE__) . DIRECTORY_SEPARATOR);
}

if (!defined('SMARTY_CORE_DIR')) {
    define('SMARTY_CORE_DIR', SMARTY_DIR . 'internals' . DIRECTORY_SEPARATOR);
}

define('SMARTY_PHP_PASSTHRU',   0);
define('SMARTY_PHP_QUOTE',      1);
define('SMARTY_PHP_REMOVE',     2);
define('SMARTY_PHP_ALLOW',      3);

/**
 * @package Smarty
 */
class Smarty
{
    /**#@+
     * Smarty Configuration Section
     */

    /**
     * The name of the directory where templates are located.
     *
     * @var string
     */
    var $template_dir    =  'templates';

    /**
     * The directory where compiled templates are located.
     *
     * @var string
     */
    var $compile_dir     =  'templates_c';

    /**
     * The directory where config files are located.
     *
     * @var string
     */
    var $config_dir      =  'configs';

    /**
     * An array of directories searched for plugins.
     *
     * @var array
     */
    var $plugins_dir     =  array('plugins');

And here is the path of my website and smarty file respectively

/home/cd/public_html

/home/cd/public_html/smarty/Smarty.class.php 


You should post the PHP code where you sey up the smarty object - where you should declare paths if different from default.

This works fine for me:

$smarty = new Smarty;
$smarty->template_dir = "./templates" ;
$smarty->compile_dir = "./templates_c" ;
$smarty->cache_dir = "./cache" ;
$smarty->config_dir = "./includes";

where the path to said folders is relative to the calling script, even if you keep it in an included file.


Absolute paths should be error-proof, I guess:

require '/home/cd/public_html/smarty/Smarty.class.php';
$smarty = new Smarty;
$smarty->template_dir = "/home/cd/public_html/themes/default/templates" ;
$smarty->compile_dir = "/home/cd/public_html/themes/default/templates_c" ;
$smarty->cache_dir = "/home/cd/public_html/themes/default/cache" ;
$smarty->config_dir = "/home/cd/public_html/themes/default/includes";

as long as you have a cache and an include folder there (you may change their names freely, or put them elsewhere). Add this while working out the hitches:

$smarty->debugging = true;

to send a complete listing of smarty variables to a pop-up page (you might have to allow this in your browser's pop-up blocker).


You don't have to change Smarty.class.php at all. You probably have a declaration like $smarty = new Smarty() in your index.php where you should find the $smarty->template_dir = "path_to_your_dir";.


I fixed it, at least my hosting company did

The problem was from the database, smarty was using the previous path from the other hosting company i moved from so i needed to update the path.

Thanks!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜