Forums / Developer / attribute_filter with AND OR

attribute_filter with AND OR

Author Message

Karl Empereur

Monday 28 March 2005 2:45:24 pm

Hi,

What do:
I have made a folder for the contrib Agenda with several children:

F1
+F2
+-F3
+-F4

I put all the agendaitems in folder F2
I have made an new override template and with the attribute_filter, I fetch all the content from folder F2 witch are not started and not yet finished with this code, where node ID 135 = F1:

     {let temp_ts=currentdate()
  	   children=fetch( content, tree, hash( parent_node_id, 135,
	   									offset, $view_parameters.offset,
										sort_by, array('attribute',true(),'agenda/date_from'),
										attribute_filter, array( 'or', array( 'agenda/date_from', '>=', $temp_ts ), array( 'agenda/date_to', '>=', $temp_ts  )),
										limit, $page_limit ) )	 }
	
                {section var=child loop=$children}
                    {node_view_gui view=line content_node=$child}
                {/section}
	{/let}

This works perfect.

What I wane do next:
I'v made another override template for folder F3 and F4 where I wane filter out several other agendaitems.
I use the 'tree' function so I can see the content of folder F2 in folder F3 and F4 but how do I make an additional filter?

Is it possible use a combination of AND and OR; like this:

attribute_filter, array(and, (( 'or', array( 'agenda/date_from', '>=', $temp_ts ), array( 'agenda/date_to', '>=', $temp_ts  )), array( 'agenda/type', '=', '1' ) ),

It would be nice if I could use 'contains' bc I wane use datatype 'selection' in my custom class for the agendaitems.

I just can't put the agendaitems not directly in folder F3 because it's possible that it's also valid for folder F4.

What's the best solution for this issue?

Grtz,
K.