Override for extension template not working

Author Message

Guy Brun

Tuesday 12 December 2006 6:27:22 am

Hi

I have made an extention foo with a template xxx.tpl. When I go to url: domain.com/foo/xxx the template xxx.tpl works great.

Then I make an override, say for node/view/full.tpl with matchfile xxx.tpl. BUT this is not working. The debug message says Unknown template variable 'resultArray' in namespace.

In extention code I have:

$tpl->setVariable( 'resultArray', $result_array );

# AND

$Result = array();
$Result['content'] =& $tpl->fetch( 'design:xxx.tpl' );

Do I have to define / import the resultArray variable some other way when overriding the template xxx.tpl ? The template works great when using the direct url(domain.com/foo/xxx)

Regards,
Guy Brun

Claudia Kosny

Wednesday 13 December 2006 1:26:38 pm

Hi Guy

If you override node/view/full.tpl with your template xxx.tpl, xxx.tpl gets exactly the same variables as the node/view/full.tpl would have gotten.

You extension calls the xx.tpl and provides the necessary variables for it, but the /node/view/full.tpl is most likely called by some other, ez internal module which does not provide this variable.

Depending on the content of the variable resultArray you might be able to use a template operator to insert this content into an template.

Claudia

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 19 2025 01:14:31
Script start
Timing: Jan 19 2025 01:14:31
Module start 'layout'
Timing: Jan 19 2025 01:14:31
Module start 'content'
Timing: Jan 19 2025 01:14:31
Module end 'content'
Timing: Jan 19 2025 01:14:31
Script end

Main resources:

Total runtime0.0174 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.0052 589.2813152.6406
Module start 'layout' 0.00520.0058 741.921939.4766
Module start 'content' 0.01100.0044 781.398489.3516
Module end 'content' 0.01540.0020 870.750030.3047
Script end 0.0174  901.0547 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002614.7474140.0002
Check MTime0.00137.2842140.0001
Mysql Total
Database connection0.00063.331710.0006
Mysqli_queries0.005430.901630.0018
Looping result0.00000.113510.0000
Template Total0.00179.610.0017
Template load0.00095.001010.0009
Template processing0.00084.588110.0008
Override
Cache load0.00063.452010.0006
General
dbfile0.00021.242780.0000
String conversion0.00000.184640.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