Loop for objects of different classes. What is wrong?

Author Message

Andrey Astakhov

Thursday 17 May 2007 2:11:34 am

Some content object Folder1 has two related objects: File1 (class: file) and Image1 (class: image)

Template for Folder1:

{foreach $node.object.related_contentobject_array as $relatedObject}
	{node_view_gui view='related' content_node=$relatedObject}
{/foreach}

There is <i>node/view/related.tpl</i> template and override template <i>related/related_image.tpl</i>

Override.ini.append contains such override (at the very top of the file):

[image_related]
Source=node/view/related.tpl
MatchFile=related/related_image.tpl
Subdir=templates
Match[class_identifier]=image

I supposed that File1 object will be displayed using <i>related.tpl</i> template and Image1 using <i>related_image.tpl</i>.

BUT both objects is displayed using <i>related.tpl</i> template.

Cache is cleared.

What's wrong?
Are my assumptions that the override system works for such object iteration wrong?

Andrey Astakhov

Friday 18 May 2007 12:55:30 am

Sergiy Pushchin from eZ systems Ukraine has explained me that i should use <b>content_view_gui</b> instead of node_vie_gui in this case because related_contentobject_array returns content object ids.

Thank Sergiy very much!

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 18 2025 21:00:12
Script start
Timing: Jan 18 2025 21:00:12
Module start 'layout'
Timing: Jan 18 2025 21:00:12
Module start 'content'
Timing: Jan 18 2025 21:00:13
Module end 'content'
Timing: Jan 18 2025 21:00:13
Script end

Main resources:

Total runtime0.6462 sec
Peak memory usage4,096.0000 KB
Database Queries52

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0056 589.2891152.6563
Module start 'layout' 0.00560.0034 741.945339.5078
Module start 'content' 0.00900.6358 781.4531427.2891
Module end 'content' 0.64480.0014 1,208.74228.1250
Script end 0.6462  1,216.8672 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00310.4778160.0002
Check MTime0.00130.1963160.0001
Mysql Total
Database connection0.00060.096110.0006
Mysqli_queries0.607293.9596520.0117
Looping result0.00050.0735500.0000
Template Total0.611594.620.3058
Template load0.00190.292720.0009
Template processing0.609694.330820.3048
Template load and register function0.00020.035610.0002
states
state_id_array0.00090.146110.0009
state_identifier_array0.00180.285820.0009
Override
Cache load0.00150.2378170.0001
Sytem overhead
Fetch class attribute can translate value0.00110.172510.0011
Fetch class attribute name0.00100.155120.0005
XML
Image XML parsing0.00010.017310.0001
class_abstraction
Instantiating content class attribute0.00000.000820.0000
General
dbfile0.00070.1100100.0001
String conversion0.00000.001640.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
2content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
5content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
2content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1content/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: 12
 Number of unique templates used: 6

Time used to render debug report: 0.0001 secs