This site has been archived and you can no longer log in or post new messages. For up-to-date community resources please visit ezplatform.com

eZ Community » Forums » General » Template override is looking into...
expandshrink

Template override is looking into extension directory?

Template override is looking into extension directory?

Thursday 24 February 2011 7:58:24 am - 4 replies

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

Modified on Thursday 24 February 2011 7:59:17 am by Chirag Patel

Thursday 24 February 2011 11: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

Thursday 24 February 2011 11: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.

Modified on Thursday 24 February 2011 11:12:05 am by André R

Thursday 24 February 2011 5:44:15 pm

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

Friday 25 February 2011 9: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

expandshrink

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from