Forums / Developer / Is this a bug, a feature or have I done something wrong ?

Is this a bug, a feature or have I done something wrong ?

Author Message

Nick Woods

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 :&nbsp;
	{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>&nbsp;
        {/section}
	{/section}
	</div>
{/section}
{/let}

Paul Forsyth

Wednesday 28 April 2004 5:23:25 am

Sounds like the folder object for 'http://www.carrotland.co.uk/events/2003' has a different sort order. Can you edit that object and compare the sort order with other year folder objects?

paul

--
http://www.visionwt.com

Nick Woods

Wednesday 28 April 2004 5:52:10 am

I have just had a look and you are correct, the sort orders are different. I checked it last night but I must have missed it (embarrased emoticon)

Thanks !

Paul Forsyth

Wednesday 28 April 2004 5:56:58 am

np :)