开发者

Where are Smarty Template Variables Defined?

开发者 https://www.devze.com 2023-03-10 00:09 出处:网络
I am working on a program with a Smarty template,where do the $variables come from as I see no file they are pulling from in the html. Where do I find these variables so I can edit them.Similarly in D

I am working on a program with a Smarty template, where do the $variables come from as I see no file they are pulling from in the html. Where do I find these variables so I can edit them. Similarly in Drupal, there are different variables available in different TPL files, because I see no includes, where is this information c开发者_如何转开发oming from/being pulled from, I know this is a noob question.


Smarty variables are set in the business logic via $smarty->assign('firstName', 'Mike');

http://www.smarty.net/docsv2/en/api.assign

You can check out the Smarty.class.php source to find out where they are actually stored (they're in a member variable named $tpl_vars).


The variables are defined in the PHP script files that use the templates. Look for lines like

$smarty->assign( "var_name", $value );


The variables are set in the PHP files that instantiate the Smarty object. You can find them by searching for the assign() calls. Since Smarty template do not (should not) contain PHP code in them, you won't see include calls.

0

精彩评论

暂无评论...
验证码 换一张
取 消