Smarty Forum Index Smarty
The discussions here are for Smarty, a template engine for the PHP programming language.
Globalnie peremennie

 
Post new topic   Reply to topic    Smarty Forum Index -> Language: Russian
View previous topic :: View next topic  
Author Message
FORT
Smarty n00b


Joined: 09 Feb 2013
Posts: 1

PostPosted: Sat Feb 09, 2013 8:46 pm    Post subject: Globalnie peremennie Reply with quote

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
View user's profile Send private message
Grizzly
Smarty Pro


Joined: 15 Apr 2011
Posts: 109
Location: Germany

PostPosted: Fri Jul 12, 2013 8:46 am    Post subject: Reply with quote

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...
_________________
BASE4U - Deine Meinung ist Wichtig!
Back to top
View user's profile Send private message Visit poster's website
Shtor
Smarty n00b


Joined: 12 Aug 2013
Posts: 1

PostPosted: Mon Aug 12, 2013 2:13 am    Post subject: Reply with quote

Хм... надо попробовать... спасибо за подсказку...
Back to top
View user's profile Send private message
Grizzly
Smarty Pro


Joined: 15 Apr 2011
Posts: 109
Location: Germany

PostPosted: Thu Aug 22, 2013 7:24 am    Post subject: Reply with quote

пожалуйста
_________________
BASE4U - Deine Meinung ist Wichtig!
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Smarty Forum Index -> Language: Russian All times are GMT
Page 1 of 1

 
Jump to:  
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
Protected by Anti-Spam ACP