|
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 |
Quille Smarty n00b
Joined: 29 Sep 2008 Posts: 2
|
Posted: Mon Sep 29, 2008 2:57 pm Post subject: Could the $smarty reserved variable support sessions? |
|
|
I'm using a lot of sessions on my website.
I therefor wondered if it is possible to make the $smarty reserved variable support these...
Example:
Code: | {if $smarty.session.logged_in eq True}
<h2>You are logged in</h2>
{/if} |
I think this addition to Smarty would be great. And since the $smarty variable already exists, why not expand it? |
|
Back to top |
|
Celeb Administrator
Joined: 17 Apr 2007 Posts: 1025 Location: Vienna
|
Posted: Mon Sep 29, 2008 3:00 pm Post subject: |
|
|
No need for any expansion since it already supports it.
In fact, the code you posted should work perfectly. _________________ Darn computers always do what I tell them to instead of what I want them to do. |
|
Back to top |
|
Quille Smarty n00b
Joined: 29 Sep 2008 Posts: 2
|
Posted: Mon Sep 29, 2008 3:06 pm Post subject: |
|
|
Celeb wrote: | No need for any expansion since it already supports it.
In fact, the code you posted should work perfectly. |
Thank you for the answer.
I must have missed that in the manual... |
|
Back to top |
|
bimal Smarty Elite
Joined: 19 Apr 2007 Posts: 423
|
Posted: Tue Jan 20, 2009 6:31 pm Post subject: |
|
|
There are some simple rules to remember:
* $_SESSION becomes "session", small-case, with removed $_ part.
* This is true for other variables like get, post, cookie, ...
* index should be case sensitive (use as typed).
* For example: $smarty.session.logged_in is from $_SESSION['logged_in']
* Reservation is identified with $smarty.
Unfortunately, there are no ways to see errors for:
$smarty.non_existent.variable. Any idea to raise an error, without {if} comparison?[/list] |
|
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
|