Smarty vs. session_name() & session_id()
| From: | Michal Prinke | Date: | Tue, 15 Oct 2002 13:32:35 +0000 |
| Subject: | Smarty vs. session_name() & session_id() | ||
| Groups: | php.smarty.general | ||
| Request: | Send a blank email to php-smarty-general+get-6141@lists.php.net to get a copy of this message | ||
I've just encountered some strange Smarty behaviour (or maybe this is my
fault? I don't know...)
I need to insert session name and session id somewhere in my template.
So I put {$smarty.session.name} and {$smarty.session.id} there;
both of them did not generate any output.
Then, I wrote a simple function:
function smarty_function_sess($params, &$smarty) {
echo("name=" . session_name() . ", id=" . session_id() .
"<br>");
}
...and called it from my template ({$sess}). No effect either.
I'm absolutely sure that I call session_start() in each of my PHP scripts,
I use various data from the $_SESSION array and they work well.
The solution was to put this line in my PHP script:
$smarty->assign(array("sess_name", "sess_id"), session_name(), session_id());
What do you think, why doesn't {$smarty.session.id} work?
Does Smarty clear session data somehow?
Thank you...