|
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 |
Roman Smarty n00b
Joined: 13 Jan 2014 Posts: 2
|
Posted: Mon Jan 13, 2014 2:58 am Post subject: Access smarty class variables from within template. |
|
|
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 |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Mon Jan 13, 2014 3:15 am Post subject: |
|
|
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 |
|
Roman Smarty n00b
Joined: 13 Jan 2014 Posts: 2
|
Posted: Tue Jan 14, 2014 7:56 pm Post subject: |
|
|
I am sure assign() will work, however i was trying to access properties without this extra step.
. |
|
Back to top |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Tue Jan 14, 2014 8:04 pm Post subject: |
|
|
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 |
|
|
|
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
|