Forums / Setup & design / Attribute Filter Usage

Attribute Filter Usage

Author Message

Niko Goers

Tuesday 30 October 2007 8:38:43 am

Hello Community,

I have one question regarding the "attribute_filter" in a simple fetch and I suspect that the fetch-documentation couldn't help me anymore. ( http://ez.no/doc/ez_publish/technical_manual/3_10/reference/modules/content/fetch_functions/list )

I want to fetch objects, which are similar to the current object.

<b>And it works fine:</b>

{def $aehnliche_themen = fetch( 'content', 'tree',
                                hash( 'parent_node_id', 2,
                                      'attribute_filter', array( 'or',
                                                                 array( 'name', 'like', $aehnliche_themen_like_1 ),
                                                                 array( 'name', 'like', $aehnliche_themen_like_2 ),
                                                                 array( 'name', 'like', $aehnliche_themen_like_3 ),
                                                                 array( 'name', 'like', $aehnliche_themen_like_4 )
                                                               ),
                                      'sort_by', array( 'published', false() ),
                                      'limit', 5
                                    )

                              )
}

<b>Now I want to exclude the current object from the fetch result, but then it doesn't work anymore:</b>

{def $aehnliche_themen = fetch( 'content', 'tree',
                                hash( 'parent_node_id', 2,
                                      'attribute_filter', array( 'and',
                                                                 array( 'or',
                                                                        array( 'name', 'like', $aehnliche_themen_like_1 ),
                                                                        array( 'name', 'like', $aehnliche_themen_like_2 ),
                                                                        array( 'name', 'like', $aehnliche_themen_like_3 ),
                                                                        array( 'name', 'like', $aehnliche_themen_like_4 ) ),
                                                                 array( array( 'name', '!=', $node.name ) ) ),
                                      'sort_by', array( 'published', false() ),
                                      'limit', 5
                                    )

                              )
}

Is it possible to do it in that way? And where are my mistakes?

Thanks for any suggestions.

eZ Publish partner - http://www.all2e.com
http://share.ez.no/directory/companies/all2e-gmbh
http://ez.no/Partners/all2e-GmbH

Lords of Heaven - http://www.LoH-Gilde.de (Created with eZ Publish)
German online gaming guild

About me - http://www.NikoGoers.de

My roadmap, +1 are welcome: http://share.ez.no/community/roadmap/10889

Heath

Tuesday 30 October 2007 8:51:20 am

Here is a thread of similar subject and confirmed solutions,
http://ez.no/developer/forum/developer/attribute_filter_breaking_fetch#msg144793

hth,
Heath

Brookins Consulting | http://brookinsconsulting.com/
Certified | http://auth.ez.no/certification/verify/380350
Solutions | http://projects.ez.no/users/community/brookins_consulting
eZpedia community documentation project | http://ezpedia.org

Niko Goers

Tuesday 30 October 2007 9:04:46 am

Hi Heath,

Thank you for the quick answer, but I don't found there an answer of my question regarding the current node exclusion.

My "attribute_filter" without the name exclusion works fine.

[...]
'attribute_filter', array( 'and',
                                                                 array( 'or',
                                                                        array( 'name', 'like', $aehnliche_themen_like_1 ),
                                                                        array( 'name', 'like', $aehnliche_themen_like_2 ),
                                                                        array( 'name', 'like', $aehnliche_themen_like_3 ),
                                                                        array( 'name', 'like', $aehnliche_themen_like_4 ) ),
                                                                 array( array( 'name', '!=', $node.name ) ) ),
[...]

The combination of the two arrays in the "attribute_filter" doesn't work. Without each other both arrays are working.

eZ Publish partner - http://www.all2e.com
http://share.ez.no/directory/companies/all2e-gmbh
http://ez.no/Partners/all2e-GmbH

Lords of Heaven - http://www.LoH-Gilde.de (Created with eZ Publish)
German online gaming guild

About me - http://www.NikoGoers.de

My roadmap, +1 are welcome: http://share.ez.no/community/roadmap/10889

Björn Dieding@xrow.de

Tuesday 30 October 2007 3:19:09 pm

another approach could be that you realte stuff via the ezkeyword datatype

Looking for a new job? http://www.xrow.com/xrow-GmbH/Jobs
Looking for hosting? http://hostingezpublish.com
-----------------------------------------------------------------------------
GMT +01:00 Hannover, Germany
Web: http://www.xrow.com/