Nested template overriding

Author Message

Oliver Dzierzon

Monday 09 February 2009 3:06:45 pm

Is it possible to define a overriding rule for a template, which itself is included by a override template. I'm using eZPublish version 4.0.1

for example:

For the template base/templates/content/main_content.tpl exits an overriding rule matching the template file base/override/templates/content/main_content_subpages.tpl.

In this template "main_content_subpages.tpl" I include the artikel template base/templates/content/article_standard.tpl" Since I want to use different article templates for some content classes, I defined an overriding rule matching the template file : base/override/templates/content/article_news.tpl.

[news]
Source=content/article_standard.tpl
MatchFile=content/article_news.tpl
Subdir=templates
Match[class_identifier]=news

My problem is, that even if the class of a content object is "news" the article_standard.tpl is loaded. Before loading the article template I fetch the available content object by the following code.

{def $cont_col1 = fetch('content',
			'list',
			hash('parent_node_id', $module_result.node_id, 
				'class_filter_type', 'include',
				'class_filter_array', array('article_standard','news'),
				
			)
		)
}
{foreach $cont_col1 as $content}
	{include uri="design:content/standard_artikel.tpl"}
{/foreach}

Yes, I have reset the cache.

ciao Olli

André R.

Monday 09 February 2009 4:02:29 pm

Direct include does not have any override rules (condidtions, like for instance class_identifier), you need to use node_view_gui to do that(se / search doc).

eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription
@: http://twitter.com/andrerom

Oliver Dzierzon

Tuesday 10 February 2009 3:51:07 am

Thank you, now it works using the following code.

{foreach fetch_alias('formular',hash('parent_node_id', $module_result.node_id)) as $article}
	{node_view_gui view="anfragenAllgemein" content_node=$article.contentobject_id}
{/foreach}

ciao olli

André R.

Tuesday 10 February 2009 3:55:40 am

why: content_node=$article.contentobject_id ???

It should be: content_node=$article as you need to pass the node object to make the overrides work correctly.

eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription
@: http://twitter.com/andrerom

Oliver Dzierzon

Tuesday 10 February 2009 5:10:28 am

Thank you. there is no special reason.
It was only the output of my confused brain ;-)

I fixed it

ciao Olli

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.