Template override is looking into extension directory?

Author Message

Chirag Patel

Wednesday 23 February 2011 10:58:24 pm

Hi,

I am learning the templates and trying to override the template for "folder" for a specific node.

I have put the overridden template in both /design/ezwebin/override/templates/ directory and extension/ezwebin/design/ezwebin/override/templates directory.

I have these override settings [override.ini.append.php] in siteaccess my_site.

[folder_test_class]
Source=node/view/full.tpl
MatchFile=folder_test_class.tpl
Subdir=templates
Match[class_identifier]=folder
Match[node]=180

And here's what I get in debug output.

node/view/full.tpl
full/folder.tpl
extension/ezwebin/design/ezwebin/override/templates/folder_test_class.tpl

I was expecting the template to be taken from /design/ezwebin/override/templates directory. I want to understand the reason, and what is the correct behavior or correct way to do it?

Thanks,
Chirag

Karol Radziuk

Thursday 24 February 2011 2:11:20 am

Hi,

eZ is looking in extension folder at first.

Order depends on [DesignSettings] in site.ini, then [ExtensionSettings].

After all eZ try to load tpl file from design/standard/... (standard is default location)

Check here: http://doc.ez.no/eZ-Publish/Technical-manual/4.x/Templates/The-template-override-system

{$me|attribute(show,1)}

André R.

Thursday 24 February 2011 2:11:28 am

The reason is the order design as used.

From a birds view eZ Publish reads the designs settings in the following order: SiteDesign, AdditionalSiteDesignList[] & StandardDesign.

For each design (and this answers your question) it finds templates in the following order: extensions (reverse order I think) and then design folder.

This template name lookup stuff is cached, hence why you need to clear template override cache when you add/remove templates.

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

Chirag Patel

Thursday 24 February 2011 8:44:15 am

Hi Karol and Andre,

Thanks for the response.

I thought new custom templates I want, should be put into the directory /design/ezwebin/override/templates/.

Am I doing that wrong? What's the right practice?
If it's right, How can I make the template override work from /design/ezwebin/override/templates/ ?

Thanks,
Chirag

Karol Radziuk

Friday 25 February 2011 12:31:24 am

Hi

Good practice is to create new files in your own extension. Then you can override file with using the same name like in ezwebin (it is extension too).

If design folder from your extension is named identically, then its declaration in settings/override/site.ini.append.php ([ExtensionSettings] ActiveExtensions[]=...) must be first (not sure for 100%).

Else if design folder from your extension is named differently, then then its design declaration in settings/siteaccess/<custom_siteaccess>/site.ini.append.php ([DesignSettings] SiteDesign=firstdesign AdditionalSiteDesignList[]=seconddesign) must be first

{$me|attribute(show,1)}

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