Forums / Setup & design / Loop for objects of different classes. What is wrong?

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!