Forums / Developer / Fetch upcoming events by section

Fetch upcoming events by section

Author Message

Wenzel Wondra

Friday 13 November 2009 4:43:58 am

Hello!
I'm trying to extend the default fetch for upcoming events to only include certain sections - without success :(

{def        
                $curr_ts = currentdate()
                 $curr_today = $curr_ts|datetime( custom, '%j')
            $curr_year =  $curr_ts|datetime( custom, '%Y')
            $curr_month = $curr_ts|datetime( custom, '%n')
            $today_ts = makedate( $curr_month, $curr_today, $curr_year )
                $upcoming_events = fetch( 'content', 'list', 
                                          hash( 'parent_node_id', 67, 
                                           'limit', 2, 
                                           'sort_by', array( 'attribute', true(), 'event/from_time'),                                                                                                    
                                           'main_node_only', true(), 
                                           'class_filter_type', 'include', 
                                           'class_filter_array', array( 'event' ),                                                                                                                                                                                            
                                           'attribute_filter', array(                                                                                                                                            
                                              'or',                        
                                              array( 'event/from_time', '>=', $today_ts ),                                                                                                                                                  
                                              array( 'event/to_time', '>=', $today_ts ),
                                              array( 'section','=',11 ) ) ) ) }

Can anybody help me, to get that fetch right?
Thank you!

wewo

Eirik Alfstad Johansen

Friday 13 November 2009 11:51:44 am

Hi Wenzel,

Are you sure you want "or" and not "and" in the attribute filter?

Also, I'm not sure if the attribute filter supports section as a parameter, but limitation might. Check out the comment on the bottom of this page:

http://ez.no/doc/ez_publish/technical_manual/4_x/reference/modules/content/fetch_functions/list

Sincerely,

Eirik Alfstad Johansen
http://www.netmaking.no/

Sylvain Gogel

Friday 13 November 2009 12:27:07 pm

section is supported as a non-attribute so it should work

You should first limit your fetch to section only to figure out if you don't mess with the dates

cheers

--
http://www.ecedi.fr
Agence Web, Créa/Conseils, Accessibilité
eZPublish, Drupal, Zend, Symfony

Sylvain Gogel

Friday 13 November 2009 12:32:05 pm

hum editing a post that contains a code tag is broken :(

--
http://www.ecedi.fr
Agence Web, Créa/Conseils, Accessibilité
eZPublish, Drupal, Zend, Symfony

Wenzel Wondra

Monday 16 November 2009 6:03:08 am

Hey!
@Eirik: You are right with your concerns on the 'or' in the fetch. The 'or' is just needed for the date/time part of the fetch. But I have no idea how to add my 'and', 'section','=','11' to the query. I tried so many combinations and none worked....
@Sylvian: The dates are right - that's the original ezwebin calendar fetch. "Only" the combination fails :(

Any help would be really appreciated :)
Thank you,

WeWo