Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

Access smarty class variables from within template.

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General
View previous topic :: View next topic  
Author Message
Roman
Smarty n00b


Joined: 13 Jan 2014
Posts: 2

PostPosted: Mon Jan 13, 2014 2:58 am    Post subject: Access smarty class variables from within template. Reply with quote

If i set in PHP $smarty->debugging = true; can i access this from template to see what setting it has like {$smarty.debugging} ?
I am not looking for this variable in particular just general way to do it.
Back to top
View user's profile Send private message
mohrt
Administrator


Joined: 16 Apr 2003
Posts: 7368
Location: Lincoln Nebraska, USA

PostPosted: Mon Jan 13, 2014 3:15 am    Post subject: Reply with quote

Code:
$smarty->assign('smarty_obj', $smarty);


I haven't tried it, but should work. I don't think I'd like this variable available to a template in general. Better:

Code:
$smarty->assign('is_debugging', $smarty->debugging);


Last edited by mohrt on Tue Jan 14, 2014 8:02 pm; edited 2 times in total
Back to top
View user's profile Send private message Visit poster's website
Roman
Smarty n00b


Joined: 13 Jan 2014
Posts: 2

PostPosted: Tue Jan 14, 2014 7:56 pm    Post subject: Reply with quote

I am sure assign() will work, however i was trying to access properties without this extra step.
.
Back to top
View user's profile Send private message
mohrt
Administrator


Joined: 16 Apr 2003
Posts: 7368
Location: Lincoln Nebraska, USA

PostPosted: Tue Jan 14, 2014 8:04 pm    Post subject: Reply with quote

You will need the extra step, as there is no typical reason to access this data from within the templates. If you have some special case need for them, then add them.
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General 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