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

"Please Note:
  • At the specific request of Ibexa we are changing this projects name to "Exponential" or "Exponential (CMS)" effective as of August, 11th 2025.
  • This project is not associated with the original eZ Publish software or its original developer, eZ Systems or Ibexa".

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