php - Is it possible to set smarty directories in a derived constructor? -


Hey, I'm trying to do something like this:

  & lt; Php class expand mystic sense {public function __ composition} {origin: __ creation (); $ SmartyRoot = '/ home / smarty /'; Parent :: SettampterDir ($ smartyRoot. "/ Templates /"); Parents :: setCompileDir ($ smartyRoot "/ templates_c /".); Parents :: setCacheDir ($ smartyRoot "/ cache /".); Parents :: setConfigDir ($ smartyRoot "/ configuration".); }} $ Smarty = New MySmarty (); $ Smarty- & gt; Display ("index.tpl"); ? & Gt;   

But it fails with a SmartyException ("unable to load template file") . smarty_internal_template.php From line 163, it looks like it examines the existence of $ this before performing any.

My system is set up works.

Any thoughts?

Are you sure the problem is that code Is from? I use all my application codes in this way:

  Class MySmarty provides sensitivity {function __construct () {global $ path, $ template_dir, $ product; Parents :: __ Construction (); $ The- gt; Template_dir = $ template_dir; $ This- & gt; Compile_dir = "$ Template_dir / tpl_c"; $ This- & gt; Config_dir = "$ template_dir / configs"; $ This- & gt; Cache_dir = "$ template_dir / cache"; (...)    

Comments