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.