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

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 20 2025 17:42:56
Script start
Timing: Jan 20 2025 17:42:56
Module start 'layout'
Timing: Jan 20 2025 17:42:56
Module start 'content'
Timing: Jan 20 2025 17:42:57
Module end 'content'
Timing: Jan 20 2025 17:42:57
Script end

Main resources:

Total runtime1.2252 sec
Peak memory usage4,096.0000 KB
Database Queries54

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0054 587.7891151.1953
Module start 'layout' 0.00540.0034 738.984436.6094
Module start 'content' 0.00881.2154 775.5938548.7656
Module end 'content' 1.22420.0010 1,324.35947.8906
Script end 1.2252  1,332.2500 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00340.2767160.0002
Check MTime0.00130.1058160.0001
Mysql Total
Database connection0.00070.060010.0007
Mysqli_queries1.186096.7944540.0220
Looping result0.00090.0746520.0000
Template Total1.193897.420.5969
Template load0.00190.155920.0010
Template processing1.191897.273620.5959
Template load and register function0.00030.027810.0003
states
state_id_array0.00150.124310.0015
state_identifier_array0.00100.085420.0005
Override
Cache load0.00150.1215140.0001
Sytem overhead
Fetch class attribute can translate value0.00050.036920.0002
Fetch class attribute name0.00140.111730.0005
XML
Image XML parsing0.00070.056720.0003
class_abstraction
Instantiating content class attribute0.00000.000630.0000
General
dbfile0.00090.0742160.0001
String conversion0.00000.000740.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
2content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
5content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
2content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 13
 Number of unique templates used: 7

Time used to render debug report: 0.0002 secs