Forums / Setup & design / Where am I going wrong with this code?

Where am I going wrong with this code?

Author Message

Ben Pirt

Tuesday 26 August 2003 7:15:49 am

Any help would be massively appreciated. What I am trying to do is create a long list of publications ordered by year, then name. With a sub heading for the year, then a list of publications for that year. I have tried the following code, where I check if 'year' is different to the previous record and if it is, output that as a heading:

<ul class="publications">
{* set children variable *}
{let year-title=1 children=fetch('content', 'list', hash(parent_node_id, $node.node_id, sort_by, array(name,false()), limit, 20))}
{section loop=$children}
{section show=$:item.data_map.year.data_int|ne($year-title)}
{set year-title=$:item.data_map.year.data_int}
<li class="pub-year">{$:item.data_map.year.data_int}</li>
{\section}
<li>
<p>{$:item.data_map.authors.data_text}</p>
<p>{$:item.data_map.title.data_text}</p>
<p>{$:item.data_map.publication.data_text}</p>
</li>
{/section}
{/let}
</ul>

It does find the change in year, but doesn't seem to want to output the publications in the part after the section in the middle. I assume this is some sort of scope problem or something, but I don't really understand why this doesn't work.

Thanks for your help,
Ben Pirt

Ben Pirt

Tuesday 26 August 2003 11:55:38 am

It appears I am not going wrong with this code, as inexplicably it works now :-)

Oh well, all's well that ends well

Ben

eZ debug

Timing: Jan 18 2025 19:15:18
Script start
Timing: Jan 18 2025 19:15:18
Module start 'content'
Timing: Jan 18 2025 19:15:19
Module end 'content'
Timing: Jan 18 2025 19:15:19
Script end

Main resources:

Total runtime0.7039 sec
Peak memory usage4,096.0000 KB
Database Queries53

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0070 588.9453180.8281
Module start 'content' 0.00700.6906 769.7734432.3047
Module end 'content' 0.69770.0062 1,202.078142.0859
Script end 0.7039  1,244.1641 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00340.4798140.0002
Check MTime0.00120.1771140.0001
Mysql Total
Database connection0.00080.109410.0008
Mysqli_queries0.664094.3268530.0125
Looping result0.00050.0646510.0000
Template Total0.672095.520.3360
Template load0.00190.273220.0010
Template processing0.670195.196220.3351
Template load and register function0.00020.033110.0002
states
state_id_array0.00150.209010.0015
state_identifier_array0.00170.243420.0009
Override
Cache load0.00160.2250270.0001
Sytem overhead
Fetch class attribute can translate value0.00070.092910.0007
Fetch class attribute name0.00100.149220.0005
XML
Image XML parsing0.00010.017210.0001
class_abstraction
Instantiating content class attribute0.00000.001020.0000
General
dbfile0.00180.2553120.0001
String conversion0.00000.001130.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
2content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
4content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
2content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 10
 Number of unique templates used: 5

Time used to render debug report: 0.0001 secs