不是有这些嘛?你这些是怎么设的。$tpl = new Smarty();
$tpl->template_dir = $g_site_root . "/templates/default/";
$tpl->compile_dir = $g_site_root . "/templates_c/";
$tpl->config_dir = $g_site_root . "/configs/";
$tpl->cache_dir = $g_site_root . "/cache/";
$tpl->cache_lifetime = 0;
$tpl->caching = false;
$tpl->left_delimiter = '{';
$tpl->right_delimiter = '}';

解决方案 »

  1.   

    require('./smarty/Smarty.class.php'); 包含这个文件,其他可以设置的,可以用相对目录$smarty = new Smarty;$smarty->template_dir = '/web/www.example.com/smarty/guestbook/templates/';
    $smarty->compile_dir = '/web/www.example.com/smarty/guestbook/templates_c/';
    $smarty->config_dir = '/web/www.example.com/smarty/guestbook/configs/';
    $smarty->cache_dir = '/web/www.example.com/smarty/guestbook/cache/';上面四个的值设置成你的旧可以了,可以用相对目录
      

  2.   

    <?php
    require_once ("Smarty/Smarty.class.php");
    class Tpl extends Smarty {
    var $template_file;
    function Tpl($title="") {
    $this->Smarty();
             $this->template_dir = 自己的路径;
             $this->compile_dir = 自己的路径;
             $this->config_dir = 自己的路径TH;
             $this->cache_dir = 自己的路径;
             $this->caching = false;
             $this->template_file = $title;
    }
    function show() {
     $this->display($this->template_file);
    }
    }
    ?>
      

  3.   

    Smarty 模版技术有那么好吗???
    现在phpwind和discuz采用的模版方式也不错啊。我看比Smarty好!
      

  4.   

    lib/Smarty_Compiler.class.php这个文件里有设置的,我把它改成了:
    var $template_dir    =  '/templates/';
    var $compile_dir     =  '/templates_c/';
    var $config_dir      =  '/configs/';运用的时候我就直接这样写的:
    $smarty = new Smarty();
    $smarty->display("head.tpl");
    放到网站根目录下运行就没事,到其他目录里就出错了。
    错误提示: 
    unable to read resource: "head.tpl" in d:\usr\www\html\libs\Smarty.class.php on line 1095
      

  5.   

    我的设置文件
    http://www.code2000.com/html.rar
      

  6.   

    看来是相应的路径里找不到tpl文件.
      

  7.   

    我改成var $template_dir    =  'd:\usr\www\html/templates/';就好了。谢谢大家的帮助了。