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

Tutorial - How to read out the a magical variable?

 
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 -> Tips and Tricks
View previous topic :: View next topic  
Author Message
bimal
Smarty Elite


Joined: 19 Apr 2007
Posts: 423

PostPosted: Wed Jun 30, 2010 8:43 am    Post subject: Tutorial - How to read out the a magical variable? Reply with quote

Download from here.. Target audience: Advanced users.

Here, the term magical - means searching an index within POST, GET, SESSION, COOKIE. An usage examle would be:

Code:
{html_options options=$subdomains selected='subdomain_id'|magical}


Here, it searches for any presence in post, get, session, cookie data for subdomain_id index. This saves a little time in coding, as you do not need to write anything in your php code to know what was your selected subdomain id.

Say, if you set $_SESSION['subdomain_id'] once, it works forever, anywhere you are in. The above example is a droop-down list of subdomains, and by default, selects the alredy chosen subdoain_id.

You might have passed that subdomain id in POST or GET flags and get a priority. For example, loading the page: edit-subdomains.php?subdomain_id=78 would magically use this id: 78, disregarding whaver was in the SESSION earlier.
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 -> Tips and Tricks 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