|
Posted by HarryG on 01/03/05 13:39
> index.tpl
> <DOCTYPE >
> <html>
> <head>
> <body>
> {if $loginflag}{inslude file='mambers.tpl' assign list of
> variables to template}{else}}{inslude file='loginform.tpl'}
> {/if}
Can you please elaborate on the above template file. I don't quite follow.
Thanks
HarryG
"Zoran Knezevic" <zoka@hotbox.ru> wrote in message
news:200311051130.hA5BUP90026409@www3.hotbox.ru...
> Vonleigh Simmons <nospam@illusionart.com>:
>
> > Hello,
> >
> > I've been writing php pages for a while, but just
> recently discovered
> > pear and smarty. I still don't have my head quite around
> some of the
> > ways of working php with smarty together; so please excuse
> me if this
> > question is very simple.
> >
> > Basically I want to make a section of the site only
> available to
> > registered users. Normally I would've just included a
> security.php page
> > that checks if you're logged in and if not prompts you for
> a
> > login/password. Now, when doing this with smarty how
> exactly would I go
> > about it? My initial thought would be to call the
> security.php page
> > from the template files that require it, and that in turn
> would display
> > the login form (maybe using another template, say
> security.tpl).
> >
> > Is this correct or am I using smarty incorrectly?
> >
> >
> > Vonleigh Simmons [vanlei]
> > San Francisco, CA
> > <www.illusionart.com/pi/>
> >
> > --
> > Smarty General Mailing List (http://smarty.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>
> this is pseudo-code how I would do it:
>
> index.php
> <?
> require (all files that are necessery);
>
> $loginflag= false;
>
> if (function_that_checks_is_user_logged
> ($list_of_parameters)) $loginflag= true;
>
> $smarty->assign('loginflag',$loginflag)
>
> //other code and assignmants here
> $smarty->dislplay('index.tpl');
>
> //disconect database and other stuff
> ?>
>
> index.tpl
> <DOCTYPE >
> <html>
> <head>
> <body>
> {if $loginflag}{inslude file='mambers.tpl' assign list of
> variables to template}{else}}{inslude file='loginform.tpl'}
> {/if}
Navigation:
[Reply to this message]
|