Forums / Developer / Passing a variable from datatype.php to datatype template

Passing a variable from datatype.php to datatype template

Author Message

Ralph Ekekihl

Wednesday 27 April 2005 8:36:54 am

Hi eZ people,

I have a problem passing a variable (a cookie) from a datatype to the datatype template.
I am trying to pass it using the "normal" method.

so in the newdatatype.php i have

include_once( 'kernel/common/template.php' );	
$tpl =& templateInit();
$tpl->setVariable( "cookie", $_COOKIE );
$Result = array();
$Result['content'] =& $tpl->fetch( "path/to/.tpl" );

and calling it from the template using:

{$cookie}

gives the error:
Unknown template variable 'cookie' in namespace 'ContentAttribute'

Is it not possible to pass variables in datatypes like that? If not, is there any other way of doing it?

//Ralph

Contactivity B.V.
http://www.contactivity.com