|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
FORT Smarty n00b
Joined: 09 Feb 2013 Posts: 1
|
Posted: Sat Feb 09, 2013 8:46 pm Post subject: Globalnie peremennie |
|
|
Vsem saljut! Mozhet kto znaet, kak v Smarty sozdat' global'nye peremennye, chtoby oni byli dostupny v vseh shablonah? Chtoby ne nado bylo kazhdyi' raz ejo sozdavat', to est' chtoby ne nado bylo delat'
Code: | $smarty->assign('var','value'); |
dlja kazhdogo shablona.... |
|
Back to top |
|
Grizzly Smarty Pro
Joined: 15 Apr 2011 Posts: 172 Location: Germany
|
Posted: Fri Jul 12, 2013 8:46 am Post subject: |
|
|
U can use an globale variable like this:
Code: | define('MY_VAR', 'VALUE'); |
and in smarty template like this:
Code: | {$smarty.const.MY_VAR} |
Or:
u can use a base class that all other classes inherit from and the base class assign the "global" variable. Than u can use the variable in all templates... |
|
Back to top |
|
Shtor Smarty n00b
Joined: 12 Aug 2013 Posts: 1
|
Posted: Mon Aug 12, 2013 2:13 am Post subject: |
|
|
Хм... надо попробовать... спасибо за подсказку... |
|
Back to top |
|
Grizzly Smarty Pro
Joined: 15 Apr 2011 Posts: 172 Location: Germany
|
Posted: Thu Aug 22, 2013 7:24 am Post subject: |
|
|
пожалуйста |
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|