Reply to Re: [SMARTY] Re: Smarty and Sessions

Your name:

Reply:


Posted by Matthew Weier O'Phinney on 10/01/70 11:20

* Jochem Maas <jochem@iamjochem.com> :
> Matthew Weier O'Phinney wrote:
> > * "Jim MacDiarmid" <jim.macdiarmid@comcast.net> :
> > > I'm very new to Smarty so I'm hoping someone can help me.
> > >
> > > Can someone explain how the $smarty.session.user variable is set? Is this
> > > something native to smarty or something unquie to the sample code I have?
> >
> > Smarty loads most of the superglobal variables (_GET, _POST, SESSION,
>
> I never realised Smarty made all the superglobals available -
> seems like madness to me.
>
<snip>
>
> also SESSION/ENV/SERVER are for programmers not designers. again MO

I do not use these often in my templates, but I *do* sometimes use the
*presence* of one or more session keys to trigger content availability
in the template:

{if $smarty.session.user}
display personalization
{/if}

Granted, on consideration, it would probably be better to assign such a
key to the template *first*:

<?php
if (!empty($_SESSION['user'])) {
$smarty->assign('userLoggedIn', true);
}
?>

{if $userLoggedIn}
display personalization
{/if}

But sometimes the shortcuts are easier. Additionally, my content
editors/designers are not putting in the Smarty elements, so I have a
large degree of safety in this regards. And since the $_SESSION array is
under the control of the script, it can be in large part trusted.

However, I *never* use $_GET, $_POST, or $_COOKIE in my templates --
like you, it seems to me that that way madness lies.

--
Matthew Weier O'Phinney
Zend Certified Engineer
http://weierophinney.net/matthew/

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация