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

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