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.

eZ debug

Timing: Jan 29 2025 14:41:46
Script start
Timing: Jan 29 2025 14:41:46
Module start 'layout'
Timing: Jan 29 2025 14:41:46
Module start 'content'
Timing: Jan 29 2025 14:41:46
Module end 'content'
Timing: Jan 29 2025 14:41:46
Script end

Main resources:

Total runtime0.0130 sec
Peak memory usage2,048.0000 KB
Database Queries3

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0043 588.2734151.2266
Module start 'layout' 0.00430.0023 739.500036.6875
Module start 'content' 0.00650.0050 776.187594.3594
Module end 'content' 0.01160.0014 870.546937.9766
Script end 0.0130  908.5234 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002216.8050140.0002
Check MTime0.00118.4144140.0001
Mysql Total
Database connection0.00075.739710.0007
Mysqli_queries0.002116.268230.0007
Looping result0.00000.062310.0000
Template Total0.00118.810.0011
Template load0.00096.968910.0009
Template processing0.00021.775210.0002
Override
Cache load0.00075.248710.0007
General
dbfile0.00097.170580.0001
String conversion0.00000.053140.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs