Connecting Tech Pros Worldwide Forums | Help | Site Map

PHP Session Variables and smarty Templates

Brennan Mann
Guest
 
Posts: n/a
#1: Jun 2 '08
Hello, I am having problems updating PHP session variables. I can set
them and see them using the following debug print_r($_SESSION); Once,
I start using smarty templates, I cannot modify the PHP session
variables. Does smarty tags overwrite or disable PHP session vars?


session_name("ShoppingCartUserSession");
session_start();
session_register("iwsUsername");
session_register("iwsFirstName");
session_register("iwsAdminLogin");
$_SESSION["iwsUsername"] = "Brennan";


Once I hit the smarty template

$smarty->display("index.html");

The session variable is now static for the entire session:
$_SESSION["iwsUsername"]

I can no longer modify and of the PHP session variables. I am not
using any PHP header/location redirects.

Any insight would be greatly appreciated.

Thanks,
Brennan

petersprc
Guest
 
Posts: n/a
#2: Jun 2 '08

re: PHP Session Variables and smarty Templates


It may be a caching issue. Try setting
session_cache_limiter('nocache').

Check out the response headers using Live HTTP Headers for FF:

https://addons.mozilla.org/en-US/firefox/addon/3829

Regards,

John Peters

On Apr 13, 3:50 pm, Brennan Mann <brennan.m...@gmail.comwrote:
Quote:
Hello, I am having problems updating PHP session variables. I can set
them and see them using the following debug print_r($_SESSION); Once,
I start using smarty templates, I cannot modify the PHP session
variables. Does smarty tags overwrite or disable PHP session vars?
>
session_name("ShoppingCartUserSession");
session_start();
session_register("iwsUsername");
session_register("iwsFirstName");
session_register("iwsAdminLogin");
$_SESSION["iwsUsername"] = "Brennan";
>
Once I hit the smarty template
>
$smarty->display("index.html");
>
The session variable is now static for the entire session:
$_SESSION["iwsUsername"]
>
I can no longer modify and of the PHP session variables. I am not
using any PHP header/location redirects.
>
Any insight would be greatly appreciated.
>
Thanks,
Brennan
Closed Thread


Similar PHP bytes