繼承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 這種沒人性的模版引擎。
------解決方案--------------------
因為那東西麻煩死了