Hello,
For a specific project i need a session in an udt. In this specific example i can't use frontendusers or other core packages.
So session_start() and assigning value's in the udt does not work like in native php. De variables are empty.
Should i store the session in global $gCms for example ?
Anyone experience with a custom session in a udt tag ?
Thnx
SOLVED: Generate session in UDT, possible ?
SOLVED: Generate session in UDT, possible ?
Last edited by eus on Fri Jun 17, 2011 7:08 am, edited 1 time in total.
Re: Generate session in UDT, possible ?
In my limited php experience, session vars whether created in the content or via a UDT, dont take effect until the page is refreshed/redirected.
Is your session var called after a redirect?
Is your session var called after a redirect?
Re: Generate session in UDT, possible ?
What code are you using exactly and where do you place it?
You can pass variables to a UDT and use that in a session, even from a module etc..
For example:
A sample UDT called "session":
The content on my page (here we capture the page title and pass it to our UDT,but that could be any module):
You can pass variables to a UDT and use that in a session, even from a module etc..
For example:
A sample UDT called "session":
Code: Select all
session_start();
$_SESSION['yoursession'] = $params['yourinput'];
echo $_SESSION['yoursession'];
Code: Select all
{capture assign='test'}
{title}
{/capture}
{session yourinput=$test}
Re: Generate session in UDT, possible ?
Don't know if it helps, but you don't necessarily need a UDT to display the value of a session. It can be done with Smarty directly
http://www.smarty.net/docsv2/en/languag ... ty.request
Code: Select all
{* display the php session variable "id" ($_SESSION['id']) *}
{$smarty.session.id}
Generate session in UDT, possible ?
Hello,
Thanx for the suggestions. I've solved it by doing this in an UDT.
@session_regenerate_id() ;
$session=session_id() ;
It looks like session_start was already loaded in the cms
Thanx for the suggestions. I've solved it by doing this in an UDT.
@session_regenerate_id() ;
$session=session_id() ;
It looks like session_start was already loaded in the cms