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/

eZ debug

Timing: Jan 20 2025 00:20:54
Script start
Timing: Jan 20 2025 00:20:54
Module start 'content'
Timing: Jan 20 2025 00:20:55
Module end 'content'
Timing: Jan 20 2025 00:20:55
Script end

Main resources:

Total runtime1.2107 sec
Peak memory usage4,096.0000 KB
Database Queries199

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0069 588.9453180.8438
Module start 'content' 0.00691.0746 769.7891617.4141
Module end 'content' 1.08150.1291 1,387.2031341.3828
Script end 1.2107  1,728.5859 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00400.3334210.0002
Check MTime0.00150.1240210.0001
Mysql Total
Database connection0.00060.047710.0006
Mysqli_queries1.126893.06521990.0057
Looping result0.00200.16401970.0000
Template Total1.179897.420.5899
Template load0.00200.164120.0010
Template processing1.177897.277520.5889
Template load and register function0.00010.009210.0001
states
state_id_array0.00130.106110.0013
state_identifier_array0.00150.125520.0008
Override
Cache load0.00170.1381290.0001
Sytem overhead
Fetch class attribute can translate value0.00130.110740.0003
Fetch class attribute name0.00100.085770.0001
XML
Image XML parsing0.00300.248940.0008
class_abstraction
Instantiating content class attribute0.00000.001380.0000
General
dbfile0.01100.9080400.0003
String conversion0.00000.000530.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

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
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 23
 Number of unique templates used: 7

Time used to render debug report: 0.0002 secs