dexus Posted December 5, 2007 Share Posted December 5, 2007 I would like to add some variables in header template (or maybe somwhere else) that can be used in all template files. For example I tried to add to header.tpl something like this... {php} $myVar = "something"; {/php} and tried to use it in template as {$myVar} but that doesn't work I never used smarty before so I just don't know how the php code in header should look like that will add variable that can be later used in all template files. 0 Quote Link to comment Share on other sites More sharing options...
bear Posted December 5, 2007 Share Posted December 5, 2007 Maybe this link will help a bit? http://smarty.php.net/crashcourse.php 0 Quote Link to comment Share on other sites More sharing options...
dexus Posted December 5, 2007 Author Share Posted December 5, 2007 Yes, that helped, thanks If someone else is interested, variables can be added to header.tpl file like this: {php} $this->assign('myVar', 'my custom value'); {/php} and can be used later across all template files like this: {$myVar} 0 Quote Link to comment Share on other sites More sharing options...
bear Posted December 5, 2007 Share Posted December 5, 2007 Well done, and thanks for sharing the solution! 0 Quote Link to comment Share on other sites More sharing options...
Zorro67 Posted September 2, 2008 Share Posted September 2, 2008 Old thread, but Smarty docs have moved updated location is http://www.smarty.net/crashcourse.php the WIKI link is also outdated 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.