Why dont this code work?

Author Message

Claus Jensen

Thursday 28 August 2003 4:19:53 am

Hi,
I try to fetch the child objects of the childs of Frontpage (node id = 2), so i can make a menu with subitems of items and so on. And then I get this from debug:
Unknown template variable 'children2' in namespace ''

Here's the code:
{let children=fetch('content',list,hash(parent_node_id,2))}
{section name=Child loop=$children}

<table border="0">
<tr>
<td><p><font color="#FF6600"><strong>{$Child:item.name|wash}</strong></font></p></td>
</tr>
{let children2=fetch('content',list,hash(parent_node_id,$Child:item.node_id))}
{section name=Child2 loop=$children2}

<tr>
<td><p><strong>{$Child2:item.name|wash} </strong></p>
</td>
</tr>
{/section}
{/let}
<tr>
<td>
<table width="100%" border="0" cellpadding="1" cellspacing="1">
<tr>
<td rowspan="5"></td>
<td></td>
</tr>
</table>
</td>
</tr>
</table>

{/section}
{/let}

thanks,
claÜs

Jan Borsodi

Thursday 28 August 2003 4:39:33 am

You are changing the namespace here:
{section name=Child loop=$children}

This means that you have to refer to the variable in that namespace like this:

{let children2=fetch('content',list,hash(parent_node_id,$Child:item.node_id))}
{section name=Child2 loop=$Child:children2}

Also the next variable lookup must have the first namespace as well, like:
{$Child:Child2:item.name|wash}

--
Amos

Documentation: http://ez.no/ez_publish/documentation
FAQ: http://ez.no/ez_publish/documentation/faq

Claus Jensen

Thursday 28 August 2003 4:57:47 am

AHA! Its ez!

Thanks Jan,
claÜs

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 18 2025 16:10:42
Script start
Timing: Jan 18 2025 16:10:42
Module start 'layout'
Timing: Jan 18 2025 16:10:42
Module start 'content'
Timing: Jan 18 2025 16:10:43
Module end 'content'
Timing: Jan 18 2025 16:10:43
Script end

Main resources:

Total runtime1.0955 sec
Peak memory usage4,096.0000 KB
Database Queries57

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0070 589.3359152.6250
Module start 'layout' 0.00700.0031 741.960939.4453
Module start 'content' 0.01011.0841 781.4063539.7734
Module end 'content' 1.09420.0012 1,321.179712.1641
Script end 1.0955  1,333.3438 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00340.3144160.0002
Check MTime0.00140.1275160.0001
Mysql Total
Database connection0.00110.097310.0011
Mysqli_queries1.041195.0378570.0183
Looping result0.00050.0445550.0000
Template Total1.060296.820.5301
Template load0.00230.207220.0011
Template processing1.057996.569820.5290
Template load and register function0.00020.021910.0002
states
state_id_array0.00100.095310.0010
state_identifier_array0.00160.145920.0008
Override
Cache load0.00200.1807510.0000
Sytem overhead
Fetch class attribute can translate value0.00050.045420.0002
Fetch class attribute name0.00090.082140.0002
XML
Image XML parsing0.00070.066120.0004
class_abstraction
Instantiating content class attribute0.00000.000740.0000
General
dbfile0.00080.0726170.0000
String conversion0.00000.001040.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
3content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
8content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
9content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
1content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 23
 Number of unique templates used: 6

Time used to render debug report: 0.0001 secs