Wednesday 28 April 2004 4:54:14 am
Go to http://www.carrotland.co.uk/events/2002 and note the ordering of the 'other years' entries near the top of the page Then go to http://www.carrotland.co.uk/events/2003 and do the same and then http://www.carrotland.co.uk/events/2004 In case you didnt spot it, the 2003 entry has the order of the years reversed when compared to all the others. The puzzle is that the code that generates the 'year bar' is the same each time, and is done using a template which overrides full.tpl for the class which holds the year. The data structure is this
Folder (standard folder class, named 'Events' in this case)
..... Year (custom class, one field with just the year in it, one per year ...........Event (custom class, one per event)
ie.g
Folder (Event)
....... Year (2002)
............ 2002 event 1
............ 2002 event 2
....... Year (2003)
............ 2003 event 1
............ 2003 event 2
....... Year (2004)
............ 2004 event 1 ............ 2004 event 2 and so on This is the code that generates the 'year bar', basically it reads all the sibling years of the one currently being displayed and lists them out. The current year isnmt made into a link but all the others are
{* get all the other years for this parent *}
{let other_years=fetch( content, list, hash( parent_node_id, $node.parent.node_id,
sort_by, $node.sort_array,
class_filter_type, include,
class_filter_array, array('year' ) )
) }
{* if there is another year show a selector *}
{section show=count($other_years)|gt(1)}
<div class="event_year_link">Other years :
{section name=Year loop=$other_years }
{section show=$Year:item.object.data_map.year.data_int|eq($node.object.data_map.year.data_int)}
{attribute_view_gui attribute=$Year:item.object.data_map.year} {* no link on this year *}
{section-else}
<a href={$Year:item.url_alias|ezroot}>{attribute_view_gui attribute=$Year:item.object.data_map.year}</a>
{/section}
{/section}
</div>
{/section}
{/let}
|