sorting fetch

Author Message

risto CMS user

Tuesday 07 February 2006 2:47:12 am

I have this code

<ul>
{section name=Child loop=fetch( content,
                     list,
                     hash( 
                           parent_node_id,    110,
                           limit,                    5,
                           class_filter_type,  include,
                           class_filter_array, array( 'article' )
						  ))}

<li>{node_view_gui view=listitem content_node=$Child:item}</li>
						   
{/section}
</ul>

can someone explain how to use sortby her?
both sorting by published and name

Massimo Sanna

Tuesday 07 February 2006 3:08:09 am

Hi there, you have to use the sort_by directive in your fetch.
More info here:
http://ez.no/doc/ez_publish/technical_manual/3_6/reference/modules/content/fetch_functions/list

Since you're going to sort items by published and name you have to use an array, like this

{section name=Child loop=fetch( content,list,hash(parent_node_id,110,limit,5,class_filter_type, include,class_filter_array, array( 'article' ),'sort_by',array( array( 'published',false() ), array( 'name', false() )))}

Hope this is helpful!
Max

risto CMS user

Tuesday 07 February 2006 4:44:55 am

perfect thanx ;-)

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 18 2025 04:26:26
Script start
Timing: Jan 18 2025 04:26:26
Module start 'layout'
Timing: Jan 18 2025 04:26:26
Module start 'content'
Timing: Jan 18 2025 04:26:27
Module end 'content'
Timing: Jan 18 2025 04:26:27
Script end

Main resources:

Total runtime0.9205 sec
Peak memory usage4,096.0000 KB
Database Queries57

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0054 588.9063152.6094
Module start 'layout' 0.00540.0023 741.515639.4141
Module start 'content' 0.00770.9114 780.9297513.0781
Module end 'content' 0.91900.0014 1,294.007812.1953
Script end 0.9204  1,306.2031 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00320.3468160.0002
Check MTime0.00140.1480160.0001
Mysql Total
Database connection0.00090.098710.0009
Mysqli_queries0.871194.6342570.0153
Looping result0.00070.0777550.0000
Template Total0.886996.420.4435
Template load0.00200.214720.0010
Template processing0.884996.140420.4425
Template load and register function0.00010.010710.0001
states
state_id_array0.00090.100610.0009
state_identifier_array0.00190.209920.0010
Override
Cache load0.00160.1754200.0001
Sytem overhead
Fetch class attribute can translate value0.00060.061120.0003
Fetch class attribute name0.00110.115050.0002
XML
Image XML parsing0.00110.124920.0006
class_abstraction
Instantiating content class attribute0.00000.001460.0000
General
dbfile0.00110.1145220.0000
String conversion0.00000.000640.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
3content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
3content/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/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
3content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 18
 Number of unique templates used: 7

Time used to render debug report: 0.0002 secs