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

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 22:31:13
Script start
Timing: Jan 18 2025 22:31:13
Module start 'layout'
Timing: Jan 18 2025 22:31:13
Module start 'content'
Timing: Jan 18 2025 22:31:13
Module end 'content'
Timing: Jan 18 2025 22:31:13
Script end

Main resources:

Total runtime0.0167 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.0056 588.0313152.6406
Module start 'layout' 0.00560.0030 740.671939.4766
Module start 'content' 0.00860.0060 780.148489.2266
Module end 'content' 0.01460.0021 869.375030.3047
Script end 0.0167  899.6797 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002716.0671140.0002
Check MTime0.00126.9254140.0001
Mysql Total
Database connection0.00074.191710.0007
Mysqli_queries0.002615.559730.0009
Looping result0.00000.071310.0000
Template Total0.001810.710.0018
Template load0.00116.456510.0011
Template processing0.00074.207410.0007
Override
Cache load0.00084.895810.0008
General
dbfile0.00148.561680.0002
String conversion0.00000.179640.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