Forums / Developer / Impact of extension order on templates and settings

Impact of extension order on templates and settings

Author Message

Hakim Bouras

Tuesday 06 October 2009 8:38:39 am

Hi,

I am using EZ 4.1.3, and in my settings/override/site.ini I have two extensions, declared in the following order :

[ExtensionSettings]
ActiveExtensions[]=extension1
ActiveExtensions[]=extension2

I noticed that <b>the templates are overriden in the oposite order than the settings</b> in these extensions.

so

extension2/templates/myTemplate.tpl is used
while
settings in extension1/settings/site.ini are used ...

Is it a normal / expected behaviour ?

Thanks,
Hakim

Gaetano Giunta

Tuesday 06 October 2009 8:44:47 am

It depends on your definition of 'normal', I guess...

It is unfortunately to be expected.

Principal Consultant International Business
Member of the Community Project Board

Hakim Bouras

Tuesday 06 October 2009 8:52:14 am

Thanks for your reply.

Well, I was expecting I was doing something wrong...

So to summary, does it mean that we have to choose between using "settings override" or "template override" ?

Hakim

Gaetano Giunta

Tuesday 06 October 2009 9:27:58 am

There's a lot of ways to get to the results you want, usually, albeit with a maintenance burden bigger than expected.

If extension A declares his templates as part of design A, you can code extension B to put his ones in design B. Then in the design fallback chain you put design B first, and the designs of extension B will always become before the ones from extension A, regardless of the order of extension loading.

As for the override.ini file itself, I usually try to keep it whole in a siteaccess, and not to split it between settings/override,settings/siteaccess and extension/xxx/settings, because it is hard enough to maintain it when it is a single block (it is the only one where the order of configuration blocks matters).

Note: most of the time the extensions ADD new settings, so the cases where the order of loading is important should not be many (such cases might be eg. the reset of array-valued settings as the tabs shown in the admin interface or the active login handlers). If you have many conflicts, it is generally a sign of a layering problem within your extensions. The same applies to the templates fallbacks and overrides.

Principal Consultant International Business
Member of the Community Project Board

Hakim Bouras

Tuesday 06 October 2009 9:48:02 am

I made a mistake : settings and templates are overriden in the same order. By reading you, I realised that I used different design as you explain because I had an overriding order issue between templates and stylesheets...

Having all the override mechanisms working in the same order would be easier to manage...

Thanks for your help.
Hakim

eZ debug

Timing: Jan 18 2025 11:13:29
Script start
Timing: Jan 18 2025 11:13:29
Module start 'content'
Timing: Jan 18 2025 11:13:29
Module end 'content'
Timing: Jan 18 2025 11:13:29
Script end

Main resources:

Total runtime0.7801 sec
Peak memory usage4,096.0000 KB
Database Queries64

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0059 587.8594180.8125
Module start 'content' 0.00590.7700 768.6719573.3047
Module end 'content' 0.77590.0041 1,341.976646.0703
Script end 0.7800  1,388.0469 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00310.3946140.0002
Check MTime0.00140.1772140.0001
Mysql Total
Database connection0.00070.093210.0007
Mysqli_queries0.728993.4452640.0114
Looping result0.00070.0908620.0000
Template Total0.750596.220.3752
Template load0.00200.250920.0010
Template processing0.748595.953020.3743
Template load and register function0.00010.014010.0001
states
state_id_array0.00120.155510.0012
state_identifier_array0.00120.157920.0006
Override
Cache load0.00160.2073370.0000
Sytem overhead
Fetch class attribute can translate value0.00070.088720.0003
Fetch class attribute name0.00120.150370.0002
XML
Image XML parsing0.00110.136420.0005
class_abstraction
Instantiating content class attribute0.00000.0021100.0000
General
dbfile0.00110.1355240.0000
String conversion0.00000.000630.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/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
5content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
9content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
1content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
3content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 25
 Number of unique templates used: 7

Time used to render debug report: 0.0001 secs