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/

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 20 2025 00:52:57
Script start
Timing: Jan 20 2025 00:52:57
Module start 'layout'
Timing: Jan 20 2025 00:52:57
Module start 'content'
Timing: Jan 20 2025 00:52:58
Module end 'content'
Timing: Jan 20 2025 00:52:58
Script end

Main resources:

Total runtime1.1502 sec
Peak memory usage4,096.0000 KB
Database Queries62

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0062 589.1484152.6250
Module start 'layout' 0.00620.0041 741.773439.4453
Module start 'content' 0.01031.1386 781.2188612.3359
Module end 'content' 1.14880.0013 1,393.554720.1719
Script end 1.1502  1,413.7266 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00330.2894160.0002
Check MTime0.00140.1188160.0001
Mysql Total
Database connection0.00070.060510.0007
Mysqli_queries1.095395.2243620.0177
Looping result0.00060.0502600.0000
Template Total1.112696.720.5563
Template load0.00230.199220.0011
Template processing1.110296.525520.5551
Template load and register function0.00010.007310.0001
states
state_id_array0.00130.113310.0013
state_identifier_array0.00250.220720.0013
Override
Cache load0.00190.1684290.0001
Sytem overhead
Fetch class attribute can translate value0.00050.039730.0002
Fetch class attribute name0.00080.069670.0001
XML
Image XML parsing0.00140.125630.0005
class_abstraction
Instantiating content class attribute0.00000.001080.0000
General
dbfile0.00110.0998290.0000
String conversion0.00000.000940.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
4content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
4content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
8content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
3content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
2content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 23
 Number of unique templates used: 7

Time used to render debug report: 0.0001 secs