RE : [SMARTY] subclassing smarty problem
| From: | Christopher Rousseau | Date: | Thu, 10 Apr 2003 08:17:37 +0000 |
| Subject: | RE : [SMARTY] subclassing smarty problem | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-9206@lists.php.net to get a copy of this message | ||
trye using this for calling parent method :
parent::Smarty()
This way you can call a parent method with the same name as current one
(usefull for overloading a method)
And of course, as Jason say, your code must be in the constructor.
-----Message d'origine-----
De : olivie hericord [mailto:ohericord@free.fr]
Envoyé : jeudi 10 avril 2003 01:51
À : smarty-general@lists.php.net
Objet : [SMARTY] subclassing smarty problem
as written by month here
http://marc.theaimsgroup.com/?l=smarty-general&m=101393751619386&w=2
i wrote something like this in my code:
myapp_setup.php
---------------
include("Smarty.class.php");
class Myapp_Smarty extends Smarty {
// call constructor
$this->Smarty();
// setup Smarty configs for your app
$this->template_dir = './my/path/to/templates';
$this->caching=true;
}
index.php
---------
include("myapp_setup.php");
$smarty = new Myapp_Smarty;
$smarty->display('index.tpl');
but it gives me an error!!!
Parse error : parse error, unexpected T_VARIABLE, expecting
T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in
/Users/me/MySites/myproject/code/myapp_setup.php on line 5
line 5 is $this->Smarty();
What's going on...i don't undersatnd