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

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 31 2025 04:13:58
Script start
Timing: Jan 31 2025 04:13:58
Module start 'layout'
Timing: Jan 31 2025 04:13:58
Module start 'content'
Timing: Jan 31 2025 04:13:58
Module end 'content'
Timing: Jan 31 2025 04:13:58
Script end

Main resources:

Total runtime0.0124 sec
Peak memory usage2,048.0000 KB
Database Queries3

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0045 588.3906151.2422
Module start 'layout' 0.00450.0022 739.632836.7109
Module start 'content' 0.00670.0045 776.343890.3438
Module end 'content' 0.01120.0012 866.687529.9922
Script end 0.0123  896.6797 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002117.2620140.0002
Check MTime0.00097.4104140.0001
Mysql Total
Database connection0.00064.890210.0006
Mysqli_queries0.001915.660930.0006
Looping result0.00000.080910.0000
Template Total0.00097.610.0009
Template load0.00075.366110.0007
Template processing0.00032.181110.0003
Override
Cache load0.00053.894010.0005
General
dbfile0.00021.845980.0000
String conversion0.00000.048240.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs