How to use fetch with attribute_filter?

Author Message

Milad P

Wednesday 14 June 2006 2:52:58 am

I have a date object in my class 'scholarship and i want to use 'attribute_filter' to sort my items after the month value in my date object. How do i do that?

{set list_items=fetch_alias( children, hash( parent_node_id, $node.node_id,
offset, $view_parameters.offset, sort_by, array( array('attribute', false(), 'scholarship/seekdate')),
attribute_filter, array(array('scholarship/seekdate.month', '<', $now)), limit, $page_limit ) )}

I can make it work for the whole date object, but i want to filter after month.

Kristof Coomans

Wednesday 14 June 2006 3:44:05 am

Hi

You can make a date with the makedate template operator ( http://ez.no/doc/ez_publish/technical_manual/3_8/reference/template_operators/miscellaneous/makedate ). and put it in $now.

independent eZ Publish developer and service provider | http://blog.coomanskristof.be | http://ezpedia.org

Milad P

Wednesday 14 June 2006 4:45:20 am

My problem is to convert

'scholarship/seekdate.month'

to only month. $now is defined as $now = maketime().

i tried

  attribute_filter, array(array(makedate(currentdate()|datetime('scholarship/seekdate','%m')), '<', currentdate('custom', '%m') ))

but it didn't work. My plan was to take out month from seekdate and compare it with current month.

Kristof Coomans

Wednesday 14 June 2006 5:30:49 am

{let $now=makedate()
    $timeStruct=gettime( $now )
    $firstDayOfTheMonth=makedate( $timeStruct.month, 1, $timeStruct.year )}

Now use an attribute filter like:

array( 'and', array( 'scholarship/seekdate', '<' , $firstDayOfTheMonth ) )

This will give you all scholarships before the current month.

It's not possible to fetch everything of a specific month ( without specifying the year ).

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

Main resources:

Total runtime0.0215 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.0089 587.9297152.6250
Module start 'layout' 0.00890.0031 740.554739.4453
Module start 'content' 0.01200.0069 780.000093.3359
Module end 'content' 0.01890.0026 873.335934.3047
Script end 0.0214  907.6406 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002712.6049140.0002
Check MTime0.00114.9878140.0001
Mysql Total
Database connection0.00104.802410.0010
Mysqli_queries0.004420.305430.0015
Looping result0.00000.060010.0000
Template Total0.00219.710.0021
Template load0.00104.503710.0010
Template processing0.00115.165410.0011
Override
Cache load0.00073.105710.0007
General
dbfile0.00156.975380.0002
String conversion0.00000.037840.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