logo       

Re: [SMARTY] Smarty and Superglobals: msg#00439

php.smarty.general

Subject: Re: [SMARTY] Smarty and Superglobals


Absolutely.

One of the nice things about smarty is the ability to get session information
from within the template. It is a beautiful tool for dealing with shopping
carts...

{foreach from=$smarty.session.cart.item item=i}
{$i.qty} - {$i.description} ${i.price}
{/foreach}

Is a quick way to output the cart contents....

You can find the other request vars in the manual:

http://smarty.php.net/manual/en/language.variables.smarty.request.php


On Wednesday 29 January 2003 22:21, m guckeyson wrote:
> Is there a best practice for dealing with superglobals ( $_SESSION,
> $_SERVER, etc) from Smarty templates? I had assumed they would be available
> to the template without having to explicitly assign them, but that doesn't
> seem to be the case. So, while pondering why that would be, I began to
> wonder if I was missing some glaringly obvious reason to not pass them
> along, implicitly or otherwise.
>
> $smarty->assign( '_SESSION' , $_SESSION ) at the top of every page is
> growing tedious... but I'm always willing to hear a better implementation..


--
Smarty General Mailing List (http://smarty.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise