PHP Session Variables and smarty Templates

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
Brennan Mann [ So, 13 April 2008 21:50 ] [ ID #1941639 ]

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... [at] gmail.com> wrote:
> 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 [ Mo, 14 April 2008 00:55 ] [ ID #1942170 ]
PHP » comp.lang.php » PHP Session Variables and smarty Templates

Vorheriges Thema: [fpdf] setSourceFile gone in fpdf v.1.53
Nächstes Thema: I seek a script PHP allowing to post the horraire weeks of employees