Access Request variables from smarty templates
January 25, 2011 – 5:13 pmIn smarty templates you can access Request variables available in PHP scripts using the reserved template variable {$smarty}. Request variables include $_GET, $_POST, $_SERVER, $_ENV, $_COOKIE and $_SESSION.
Have a look:
“http://www.phpwebdevelopment.org/index.php?result=about”
//Output the value of $_GET['result'] from the url
{$smarty.get.result}
//Output the value of $_POST['result'] from a posted form
{$smarty.post.result}
//Output a cookie variable, $_COOKIE['status'] from request header
{$smarty.cookies.status}
//Output a server variable, $_SERVER['SERVER_NAME']
{$smarty.server.SERVER_NAME}
//Output a system environment variable, $_ENV['PATH']
{$smarty.env.PATH}
//Output a session variable, $_SESSION['userid']
{$smarty.session.userid}
//Output the value of "username" from merged get/post/cookies/server/env
{$smarty.request.username}