What are the problems encountered when inheriting the smarty class !! I copied the libs directory of smarty to the test project. the test project is simple and has two file demos. php and init. inc. php, and then in init. inc. php makes some configuration, such as the delimiter and template directory. if you use this method: PHPcode & lt; to inherit from the problems encountered by the smarty class, please guide me !!
I copied the libs directory of smarty to the test project. the test project is simple and has two file demos. php and init. inc. php, and then in init. inc. php makes some configuration, such as the delimiter and template directory. if this method is used:
PHP code
left_delimiter="
";?>
After the configuration is complete, write this in demo. php.
PHP code
assign("title",$title); $tpl->assign("content",$content); $tpl->display("default/test.tpl");?>
Show no problem
If the mySmarty code of another class that inherits from the smarty class is as follows, in 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'); } } ?>
In demo. php, I make the following calls and displays
PHP code
assign("title",$title); $tpl->assign("content",$content); $tpl->display("default/test.tpl");?>
The error 500 will be reported. what is going on? please kindly advise. thank you !!
------ Solution --------------------
If you enable the php error display function, you will know where the problem is.
Inherited
If it is Smarty 2, there should be no big mistake
If it's Smarty 3, it's another thing.
------ Solution --------------------
I have been working for six years, and I will tell you how to give up the smarty unhuman template engine as soon as possible.
------ Solution --------------------
Because it's annoying.