Forums / Setup & design / Fetching by Priority

Fetching by Priority

Author Message

Arran Price

Tuesday 18 January 2005 7:24:32 pm

Hi,
Im attempting to fetch articles in a folder via priority and am having no luck.
I have a folder with order based on priority and have assigned all the articles in it to have different priority numbers from 0 through 7. I am getting the articles returned from my fetch, but not in priority order. I cant even figure out what the order is based on (not published date, not priority and not alphabetical). The limit and offset appear to work fine.

Here is the code Im currently trying to use and have tried various other combinations with no luck.

{set news=fetch( 'content', 'list', 
         			hash( 'parent_node_id', $news_node, 
         			      'priority', 'true',
         			      'offset',$offset,
         			      'limit',$limit,
         				 )
			      )    
}

Can anyone see what Im doing wrong here?

Any help greatly appreciated.

cheers

Arran

Eivind Marienborg

Tuesday 18 January 2005 11:41:41 pm

See the examples here: http://www.ez.no/ez_publish/documentation/development/libraries/ez_template/operators/data_fetch

You have to include the sort_by in some way.

Balazs Halasy

Wednesday 19 January 2005 12:13:22 am

Try this:

{set news=fetch( content, list, hash( parent_node_id, $news_node, 
                                      sort_by, array( priority, true ),
                                      offset, $offset,
                                      limit, $limit ) ) }

..and the next time, look up the documentation for this fetch function:
http://ez.no/ez_publish/documentation/reference/data_fetching/content/list

Arran Price

Wednesday 19 January 2005 11:02:21 am

thanks Balazs,
that did the trick.
to note I did spend considerable time in the documentation before posting and must have had the syntax nearly correct in my attempts (my not posting the sort_by code which I had been working on was a copy paste error). Figuring out the exact syntax for the templates has been one of the more frustrating things I have encountered so far with ezpublish.

Oh well I am a beginner with this so am sure will sort it out.

thanks again

Arran