Templates, fetch and sorting

Author Message

Bruce Morrison

Monday 13 January 2003 11:28:34 pm

Having a need to sort the contents of a fetch I did some digging and have found some information in regards to the "sort_by" parameter of the fetch(content,tree,hash(parameters)) template function (and probally fetch(content,list,hash(parameters)) as well)

sort_by takes (multiple groups - I haven't tried this but the code looks like it will) of 2 parameters

sort field - the field to sort by. Valid options are
'path'
'published'
'modified'
'section'
'depth'
'class_identifier'
'class_name'
'priority'

sort_order
true = ascending
false = desending

So

fetch(content,tree,hash(parent_node_id,29,sort_by,array(published,true))

Will return all nodes under node 29 ordered from the first published to the last published.

If you do not have 2 parameters the sort will default to "path ascending"

I have also patched the system (3 additional lines) to enable to sort by object name. (See http://developer.ez.no/bug/bugview/1773/ )

Hope this helps someone.
Cheers
Bruce

My Blog: http://www.stuffandcontent.com/
Follow me on twitter: http://twitter.com/brucemorrison
Consolidated eZ Publish Feed : http://friendfeed.com/rooms/ez-publish

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 05:21:56
Script start
Timing: Jan 18 2025 05:21:56
Module start 'layout'
Timing: Jan 18 2025 05:21:56
Module start 'content'
Timing: Jan 18 2025 05:21:57
Module end 'content'
Timing: Jan 18 2025 05:21:57
Script end

Main resources:

Total runtime1.0011 sec
Peak memory usage4,096.0000 KB
Database Queries46

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0054 589.4609153.4766
Module start 'layout' 0.00540.0021 742.937539.4219
Module start 'content' 0.00750.9920 782.3594472.6406
Module end 'content' 0.99950.0015 1,255.00008.1484
Script end 1.0010  1,263.1484 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00310.3130160.0002
Check MTime0.00130.1270160.0001
Mysql Total
Database connection0.00070.069410.0007
Mysqli_queries0.955395.4251460.0208
Looping result0.00040.0406440.0000
Template Total0.970196.920.4850
Template load0.00210.214720.0011
Template processing0.967996.689620.4840
Template load and register function0.00010.012610.0001
states
state_id_array0.00070.072410.0007
state_identifier_array0.00230.233920.0012
Override
Cache load0.00170.1743270.0001
Sytem overhead
Fetch class attribute can translate value0.00120.118610.0012
Fetch class attribute name0.00060.055720.0003
XML
Image XML parsing0.00060.064710.0006
class_abstraction
Instantiating content class attribute0.00000.000420.0000
General
dbfile0.00250.2535160.0002
String conversion0.00000.000540.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
1content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
1content/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
4content/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: 13
 Number of unique templates used: 6

Time used to render debug report: 0.0001 secs