繼承smarty類時遇到的有關問題,求指導!

來源:互聯網
上載者:User
繼承smarty類時遇到的問題,求指導!!
我直接把smarty的libs目錄拷進測試專案中,測試專案很簡單,有兩個檔案demo.php和init.inc.php,然後我在init.inc.php做一些配置,比如界定符、模板目錄之類,如果是以這種方式:
PHP code
left_delimiter="";?>
配置完成後在demo.php中我這樣寫
PHP code
assign("title",$title);    $tpl->assign("content",$content);    $tpl->display("default/test.tpl");?>
顯示沒問題
如果是另外做一個繼承與smarty類的類mySmarty代碼如下,在init.inc.php中
PHP code
       Smarty();            $this->template_dir="./templates/";            $this->compile_dir="./templates_c/";            $this->config_dir="./configs/";            $this->cache_dir="./cache/";            $this->caching=true;            $this->left_delimiter="";            $this->assign('app_name','mySmartyTest');        }    }       ?>

在demo.php中我做如下的調用和顯示
PHP code
assign("title",$title);    $tpl->assign("content",$content);    $tpl->display("default/test.tpl");?>
則會報500錯誤,到底怎麼回事呢,求高手指導,謝謝!!

------解決方案--------------------
你把 php 的錯誤顯示功能開啟,就知道哪裡有問題了

繼承的
如果是 Smarty 2 應該無大錯
如果是 Smarty 3 那就是另一回事了
------解決方案--------------------
俺打工六年,就一個經驗告訴你,儘早放棄 smarty 這種沒人性的模版引擎。
------解決方案--------------------
因為那東西麻煩死了
  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.