PHP Session Variables and smarty Templates

PHP Session Variables and smarty Templates

am 13.04.2008 21:50:36 von Brennan Mann

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

Re: PHP Session Variables and smarty Templates

am 14.04.2008 00:55:27 von petersprc

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 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