Forums / Developer / Filtering news

Filtering news

Author Message

Pål Messenlien

Monday 10 October 2005 3:35:38 pm

Im working on a news page here. I want to list out the news this way:

[Topic] with priority 1
Latest news:
[News] Sorted by priority and date

All the news are inside the same folder with and are using a class named "nyhet".
Here is the code i have so far.. but i cant seem to sort the list by first priority then date.

{def $articles=fetch('content','tree', hash('parent_node_id', 196,
				'class_filter_type',  'include',
              	'class_filter_array', array( 'nyhet' ),
				'sort_by', array( array( 'priority' ), 'and', array( 'published', false() )),
              	'limit', 15
				))}
				
{*$articles|attribute(show,1)*}
{foreach $articles as $article max 1}
	{node_view_gui content_node=$article view='line'}
{/foreach}

<h3>Latest news</h3>

{foreach $articles as $article offset 2 max 5}
	{node_view_gui content_node=$article view='line'}
	<br />
{/foreach} 

Any suggestions?

--------------------------------------------
Høgskolen i Lillehammer
Lillehammer University College
http://www.hil.no
--------------------------------------------
Messenlien IT
http://messenlien.com
-------------------------------------------

Kristof Coomans

Wednesday 12 October 2005 1:36:43 am

Try to remove the entry <i>'and'</i> in your <i>'sort_by'</i> array.

independent eZ Publish developer and service provider | http://blog.coomanskristof.be | http://ezpedia.org