Forums / Developer / Attribute filtering example

Attribute filtering example

Author Message

Lars Eirik R

Thursday 04 March 2010 2:39:52 am

i woule like to return all nodes which either has an attribute show_report = 1 as well as all class instances where this attribute does not exist.

the following is my attempt:

fetch('content','list',hash('parent_node_id', $node.node_id,
'offset', $view_parameters.offset,
'class_filter_type','exclude',
'class_filter_array',array(''article'),
'attribute_filter',array('or',
array('container/show_report','=','1'),
array('*/class_attribute','!=','show_report')
),

'sort_by', $node.sort_array))}

I was hoping there would be a way for me to do this in a filter here instead of having to manually do template if checks at different levels.

André R.

Thursday 04 March 2010 5:22:45 am

You can not filter across several class types using attribute filter, you'll have to use a custom extended attribute filter or fetch/search functions in ezfind (if you use Solr).

eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription
@: http://twitter.com/andrerom