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

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 14:22:00
Script start
Timing: Jan 20 2025 14:22:00
Module start 'layout'
Timing: Jan 20 2025 14:22:00
Module start 'content'
Timing: Jan 20 2025 14:22:00
Module end 'content'
Timing: Jan 20 2025 14:22:00
Script end

Main resources:

Total runtime0.0170 sec
Peak memory usage2,048.0000 KB
Database Queries3

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0044 589.1484152.6250
Module start 'layout' 0.00440.0024 741.773439.4453
Module start 'content' 0.00680.0082 781.218893.4297
Module end 'content' 0.01500.0020 874.648434.3047
Script end 0.0170  908.9531 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002514.9469140.0002
Check MTime0.00116.4648140.0001
Mysql Total
Database connection0.00063.264610.0006
Mysqli_queries0.001810.435030.0006
Looping result0.00000.058810.0000
Template Total0.00169.210.0016
Template load0.00095.185310.0009
Template processing0.00074.010810.0007
Override
Cache load0.00073.834410.0007
General
dbfile0.002816.149480.0003
String conversion0.00000.036440.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs