Re: [SMARTY] two problems translated

From: Date: Fri, 19 Apr 2002 14:37:07 +0000
Subject: Re: [SMARTY] two problems translated
References: 1 2  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-3814@lists.php.net to get a copy of this message
> > Something like: > > > > $smarty->getVars(SMARTY_VARS_DEFINED, "test.tpl"); > > $smarty->getVars(SMARTY_VARS_UNDEFINED, "test.tpl"); > > $smarty->getVars(SMARTY_VARS_DEFINED + SMARTY_VARS_UNDEFINED, "test.tpl"); > > > > This way you can debug your template in your program, or > > do something according to needed vars. This can also be > > used to call up modules in my code, as the I use the vars > > as placeholders for module output in some templates... > > Now I use my own Smarty extension class for this stuff... > > What does he mean by 'undefined vars'? You have a template (test.tpl): <html> <head> <title>{$title_var} </head> <body> {$somevar} </body> </html> You have a PHP code: $smarty->assign("title_var", "Title"); At this point {$somevar} is not defined in the template. You can use this to test that you have already set all the needed vars, or you can use this to call up custom functions in your own code, depending on the vars in the template. BTW we have a get_template_vars() for getting already defined vars. We have no function to get undefined vars... Goba

« previous php.smarty.general (#3814) next »