|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
rootseire Smarty Rookie
Joined: 11 Feb 2008 Posts: 11
|
Posted: Wed Feb 13, 2008 12:52 pm Post subject: Smarty Login Integration |
|
|
Hi,
I have a site built using smarty, and i also have a separate php login script, both smarty and php are using sessions. I want to integrate the php script with the site so that:
When the user visits the site but is not logged in, and tries to add an item to the online shopping cart, they are redirected to the register page.
And also when the user is logged in, they may use the online shop throughout the site.
Is there some lines of code that i could write in the tpl file to say:
if the user is logged in, show the add to cart button, and
if they are not logged in, show a link to sign up?
On the other hand, if there was help available to get a Smarty based login script up and running, i would be very grateful if anyone could help.
Thanks in advance,
Pat |
|
Back to top |
|
kent.fallman Smarty Rookie
Joined: 12 Feb 2008 Posts: 5
|
Posted: Wed Feb 13, 2008 2:26 pm Post subject: |
|
|
im experimenting with some login pages right now .. you could let a vars value decide what to show Code: | {include file="header.html" title="Login"}
<h2>{$form_header}</h2>
{if $form_error == "yes"}
<p>{$error_message}</p>
{/if}
{if $status == "logout"}
{include file="logout_form.html"}
{elseif $status== "none"}
<p>Contact: John Rambo</p>
{else}
{include file="login_form.html"}
{/if}
{include file="footer.html"} |
|
|
Back to top |
|
Ancient Smarty Pro
Joined: 07 Jul 2007 Posts: 196 Location: Omaha, Nebraska, United States of America
|
Posted: Wed Feb 13, 2008 11:34 pm Post subject: |
|
|
Smarty has session data, along with get, request and post.
Code: | {if $smarty.session.logged_in}Shopping Cart{else}Login Required!!!{/if} |
$smarty.session.what_ever_session_name_is _________________ Smarty all the way. |
|
Back to top |
|
kent.fallman Smarty Rookie
Joined: 12 Feb 2008 Posts: 5
|
Posted: Thu Feb 14, 2008 5:26 am Post subject: |
|
|
Nice! |
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|