Sort by Date not working

Author Message

Ashley Knowles

Monday 17 April 2006 8:16:32 pm

I have a file listing setup, however, I cannot get it to sort by date (correctly)

Below is the code I am trying to use. As you can see, I have a custom attribute called "upload_date", an ezdate field, which is to be sorted in reverse chronological order (i.e. newest first). The code below, however, does not output anything.

{let children=fetch( content, list, hash( parent_node_id, 77,
                                    sort_by, array(upload_date, false(), 191),
                                    limit, 5,
                                    class_filter_type, include,
                                    class_filter_array, array( 'file' ) ) )}

Using this code, I get some output, but the files are not sorted (correctly?).

{let children=fetch( content, list, hash( parent_node_id, 77,
                                    sort_by, $node.data_map.upload_date,
                                    limit, 5,
                                    class_filter_type, include,
                                    class_filter_array, array( 'file' ) ) )}

I have tried substituting $node.data_map.upload_date with $node.data_map.upload_date.data_int, but also no luck.

Am I missing something???

Ɓukasz Serwatka

Monday 17 April 2006 11:17:19 pm

Hi Ashley,

Right syntax for attribute sorting will be:

sort_by, array( 'attribute', false(), 'yourclassid/upload_date'  )

 

Personal website -> http://serwatka.net
Blog (about eZ Publish) -> http://serwatka.net/blog

Ashley Knowles

Monday 17 April 2006 11:24:55 pm

That did the trick. Thanks :)

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 31 2025 04:19:32
Script start
Timing: Jan 31 2025 04:19:32
Module start 'layout'
Timing: Jan 31 2025 04:19:32
Module start 'content'
Timing: Jan 31 2025 04:19:32
Module end 'content'
Timing: Jan 31 2025 04:19:32
Script end

Main resources:

Total runtime0.0130 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.0048 588.1328151.2109
Module start 'layout' 0.00480.0025 739.343836.6484
Module start 'content' 0.00730.0044 775.992290.1719
Module end 'content' 0.01170.0013 866.164133.9922
Script end 0.0129  900.1563 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002217.1882140.0002
Check MTime0.00107.9822140.0001
Mysql Total
Database connection0.00064.571810.0006
Mysqli_queries0.002519.106630.0008
Looping result0.00000.077210.0000
Template Total0.00107.410.0010
Template load0.00085.894810.0008
Template processing0.00021.418610.0002
Override
Cache load0.00054.123410.0005
General
dbfile0.00097.149880.0001
String conversion0.00000.068040.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