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.

eZ debug

Timing: Jan 18 2025 22:28:36
Script start
Timing: Jan 18 2025 22:28:36
Module start 'layout'
Timing: Jan 18 2025 22:28:36
Module start 'content'
Timing: Jan 18 2025 22:28:37
Module end 'content'
Timing: Jan 18 2025 22:28:37
Script end

Main resources:

Total runtime0.5655 sec
Peak memory usage4,096.0000 KB
Database Queries63

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0042 587.9063152.6250
Module start 'layout' 0.00420.0026 740.531339.4453
Module start 'content' 0.00680.5574 779.9766560.2813
Module end 'content' 0.56430.0012 1,340.257816.1641
Script end 0.5654  1,356.4219 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00420.7509160.0003
Check MTime0.00140.2477160.0001
Mysql Total
Database connection0.00060.106510.0006
Mysqli_queries0.514991.0493630.0082
Looping result0.00050.0798610.0000
Template Total0.537795.120.2689
Template load0.00330.584820.0017
Template processing0.534494.503920.2672
Template load and register function0.00020.041010.0002
states
state_id_array0.00100.183410.0010
state_identifier_array0.00110.193820.0005
Override
Cache load0.00300.5298280.0001
Sytem overhead
Fetch class attribute can translate value0.00060.104720.0003
Fetch class attribute name0.00100.174360.0002
XML
Image XML parsing0.00060.108120.0003
class_abstraction
Instantiating content class attribute0.00000.002570.0000
General
dbfile0.00070.1252170.0000
String conversion0.00000.001140.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
5content/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/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.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: 21
 Number of unique templates used: 7

Time used to render debug report: 0.0001 secs