Forums / Setup & design / attribute_filter and ObjectRelationList

attribute_filter and ObjectRelationList

Author Message

Ulrich L.

Thursday 24 February 2005 1:56:11 pm

Can anybody help me? I'm looking for the right piece of code.
I placed information on titles and information on CDs in different places in the content tree (for good reasons...). In the CD class, there is an Object relationList attribute "list of titles" whose members point to certain titles.
While showing a title I would like to show the CD (or CDs) where the list of titles contains this certain title. How do I have to set the attribute_filter?

{let cds_containing_this_title=
   fetch( 'content', 'list', hash( parent_node_id, 94, depth, 7,
   attribute_filter, array( array( 'cd/list_of_titles'???, '???', ???) ) ) ) }

Ɓukasz Serwatka

Tuesday 01 March 2005 11:32:14 pm

Hi Uli,

This code should work. $cd store information about CD information. You can fetch it as normal node.

{let cds_containing_this_title=fetch( 'content', 'list', 
                                       hash( parent_node_id, 94, depth, 7, 
                                       attribute_filter, array( array( 'cd/list_of_titles', '=', $cd.contentobject_id) ) ) ) }

Personal website -> http://serwatka.net
Blog (about eZ Publish) -> http://serwatka.net/blog

Ulrich L.

Thursday 03 March 2005 2:10:15 pm

Luke, thank you for your answer.
("ez crew member": Congratulations!!)

However, the code above always gives back the complete list of all CDs, without filtering it.

When using the expresion 'cd/list_of_titles' it gives back an ObjectRelationList attribute, so I assume I cannot use '=' as filter parameter, right?

Do I have to loop all CDs and do a dedicated fetch command from every CD's ObjectRelationList? :-(

Thanks for an answer.

Ulrich L.

Friday 04 March 2005 3:13:46 pm

Perhaps this would help too:
How can I fetch the objects of an ObjectRelationList, so I can loop them?

{let my_objectrelationlist=fetch('content','list', ???)}
{section name=loop_on_objectrelationlist loop=example}
...
{/section}

Gabriel Ambuehl

Saturday 05 March 2005 12:21:47 am

Look into the templates for objectrelationlist. Inside should be a loop, you could then filter by hand I guess.

Visit http://triligon.org

Ulrich L.

Saturday 05 March 2005 1:52:51 am

I did it this way now, however there is much looping involved:

{* title - Line view *}

<div class="content-view-line">
    <div class="class-product">

        <h4>{$node.name|wash()}</h4>

        {let all_cds=fetch('content', 'tree', hash(parent_node_id, 94, class_filter_type, include, class_filter_array, array('cd')))}

        {section var=cd loop=$all_cds}

           {let current_list_of_titles=$cd.object.data_map.list_of_titles.content.relation_list}

           {section var=current_title loop=$current_list_of_titles}

              {section show=$current_title.contentobject_id|eq($node.contentobject_id)}
                {node_view_gui view='line' content_node=$cd}
              {/section}

           {/section}
           {/let}
        {/section}
        {/let}


   </div>
</div>

If anybody has got a suggestion how to do this with less looping, you are welcome to post here...

eZ debug

Timing: Jan 18 2025 20:49:49
Script start
Timing: Jan 18 2025 20:49:49
Module start 'content'
Timing: Jan 18 2025 20:49:51
Module end 'content'
Timing: Jan 18 2025 20:49:51
Script end

Main resources:

Total runtime1.5487 sec
Peak memory usage4,096.0000 KB
Database Queries205

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0077 587.8359180.8281
Module start 'content' 0.00771.3851 768.6641611.8672
Module end 'content' 1.39290.1558 1,380.5313337.0703
Script end 1.5487  1,717.6016 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00410.2616210.0002
Check MTime0.00150.0937210.0001
Mysql Total
Database connection0.00140.089610.0014
Mysqli_queries1.463494.49302050.0071
Looping result0.00220.14532030.0000
Template Total1.513897.720.7569
Template load0.00220.144520.0011
Template processing1.511597.599820.7558
Template load and register function0.00010.009110.0001
states
state_id_array0.00100.062510.0010
state_identifier_array0.00130.086320.0007
Override
Cache load0.00180.1166290.0001
Sytem overhead
Fetch class attribute can translate value0.00160.104640.0004
Fetch class attribute name0.00260.165370.0004
XML
Image XML parsing0.00130.082740.0003
class_abstraction
Instantiating content class attribute0.00000.001070.0000
General
dbfile0.00330.2137290.0001
String conversion0.00000.000430.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
6content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
3content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
7content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
4content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.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