在具体应用中,编译过的文件通常都在网站根目录下一个文件夹中,比如temp这样一个文件夹。
而不是在盘符根目录下的tmp这样的文件夹中,请问这个应该怎么弄啊

解决方案 »

  1.   

    你这样写是错误的。
    你看一下smarttemplate的安装说明就知道了,class.smarttemplate.php
    class.smartparser.php
    class.smartdebug.php
    smarttemplate_extensions必须在include_path设置范围下,比如 include_path = ".;c:/php/include"
    那么这三个文件和一个目录就必须在当前目录或c:/php/include中。为此,安装说明是建议你拷贝到include目录的。这样在任何目录下都可使用这个模板类。
    除非你自己修改文件中的路径代码temp、cache目录最好是绝对路径,这样就不必要到处建目录了
      

  2.   

    $_CONFIG语句放在include前。
    和我曾经一样的问题,呵呵。
      

  3.   

    我们用的都是虚拟主机,没有权限把smarttemplate下的文件拷到php目录下。为了保证通用性,只有设置它们的路径了。
    写一段实例吧?
      

  4.   

    $_CONFIG = array();
    $_CONFIG['smarttemplate_compiled'] = SMART_TEMP_DIR;
    $_CONFIG['smarttemplate_cache'] = SMART_CACHE_DIR;
    $_CONFIG['cache_lifetime'] = SMART_CACHE_LIFETIME;
    $_CONFIG['template_dir'] = SMART_TEMPLATE_DIR;
    $_CONFIG['reuse_code'] = SMART_REUSE_CODE;
    这个是放在class.smarttemplate.php中class SmartTemplate{.....之前的。另外的配置文件里
    DEFINE ('ROOT_PATH','D:/webserver/');
    DEFINE ('SMART_REUSE_CODE', false);
    DEFINE ('SMART_TEMPLATE_DIR',ROOT_PATH.'templates/default/');
    DEFINE ('SMART_TEMP_DIR',ROOT_PATH.'temp/');
    DEFINE ('SMART_CACHE_DIR',ROOT_PATH.'cache/');
    DEFINE ('SMART_CACHE_LIFETIME', 864000);
    DEFINE ('USERCACHE',FALSE);
    DEFINE ('EXT','.html');
      

  5.   

    可是编译过的tmp文件夹下的*_html.php文件夹中第一行,总是有这样一句,难道smarttemplate_extensions这个文件夹必须与程序中一个目录中吗?
    <?php
    include_once "smarttemplate_extensions/smarttemplate_extension_uppercase.php";?>
      

  6.   

    include_path 是可以动态修改的
    按照你的目录结构可以<?
    ini_set('include_path',realpath('./include'));
    require_once "class.smarttemplate.php";
    $_CONFIG = array(
      smarttemplate_compiled => "temp",
      smarttemplate_cache => "cache",
      cache_lifetime => 600,
      template_dir => "templates/default"
    );
    ....
      

  7.   

    唠叨看看呀,怎么使用啊?不过不懂得灵活运用也不行啊
    ini_set在此作什么?
    如下代码是可以运行的,可是用d:/....这样的路径是不是不太好啊?
    <?
    ini_set('include_path',realpath('./include'));  
    require_once "include/class.smarttemplate.php";
    $_CONFIG = array(
    smarttemplate_compiled => "d:/apache/htdocs/temp",
    smarttemplate_cache => "d:/apache/htdocs/cache",
    cache_lifetime => 600,
    template_dir => "d:/apache/htdocs/templates/default"
    );
        $page = new SmartTemplate("uppercase.html");
        $page->assign('TEXT', 'Simple Demo Text.');
        $page->output();
    ?>如果只用目录名则提示:Warning: output(temp/uppercase_html.php) [function.output]: failed to create stream: No such file or directory in d:\apache\htdocs\include\class.smarttemplate.php on line 278Warning: output(temp/uppercase_html.php) [function.output]: failed to create stream: No such file or directory in d:\apache\htdocs\include\class.smarttemplate.php on line 278Warning: output() [function.output]: Failed opening 'temp/uppercase_html.php' for inclusion (include_path='d:\apache\htdocs\include') in d:\apache\htdocs\include\class.smarttemplate.php on line 278
      

  8.   

    呵呵,实现了
    我发现realpath真是神奇啊,有了自定义的include_path后,
    只要是require 'xx.php';
    都是指包含这个include_path的xx.php文件,真是神奇啊