override.ini or smart file placement ?

Author Message

*- pike

Thursday 11 October 2007 2:06:40 am

Hi

there seems to be two ways to 'override' a template in a certain design:

- add a line to override.ini, where you specify the location of an alternate
template based on class or nodeid
- put the alternate template in a place where ezpublish expects it, like
../design/yourdesign/templates/node/view/line/article.tpl

- is that correct ?

- the preferred mechanism seems to be override.ini. why ?

- what is the order in which ezp checks for overrides ?
I assume override.ini overrides everything, so it is checked first ?

- which is more efficient: adding 1000 lines to override.ini (which
makes it long to parse/execute at each request) or add 1000 templates
on the right place (which needs a few system calls before ezp
finds out where the overriding template is located ) ?

currently, we use a huge override.ini, and performance is bad; i want to know if we could improve performance by decreasing the size of that file .. or i want to know how much performance will suffer if i do that anyway :-)

thanks!
*-pike

---------------
The class eZContentObjectTreeNode does.

Nabil Alimi

Thursday 11 October 2007 2:23:01 am

Interesting question. I do not have the answer but there's one thing you should know :

Override files aren't parsed every time we need them but only the first access of the site. Then, they are compiled in a simple php file.

My blog : http://www.starnab.com/ezpublish / http://www.starnab.com/ / http://www.assiki-consulting.com
eZ Publish Freelance developper. Feel free to contact me +33 674 367 057
nabil at assiki d0t fr

Laurent BOURREL

Thursday 11 October 2007 2:56:47 am

Hi,

To my mind, these 2 ways answer 2 different questions.

- Placing the tpl directly in the design is a generalization : you replace the original tpl by this one without considering the class of the object, of the attribute, the section, etc.

- Using the .ini file is a specialization : you override the template using conditions (class name, attribute name, section, ... it depends the tpl you want to override :
http://ez.no/doc/ez_publish/technical_manual/3_9/reference/template_override_conditions

hth...

*- pike

Thursday 11 October 2007 4:27:37 am

Hi

thanks for both your messages.

Laurent, ofcourse you are right, they are different mechanisms with different usages. I have a override.ini with a lot of ClassID matches, which I could also simply do with smart template placement; but there are other cases in which they are not interchangeable.

Nabil, indeed the override.ini file get's 'cached' into a php file (in var/xxx/cache/override). Not sure if it is a 'simple' file though, it is a large php array (105k in my case), which contains a lot of php conditionals that have to be eval()'ed. This has to happen at every request, so it is still a big overhead in performance, and ~100k of memory, I guess.

So, what would be the most efficient ?

thanks!
*-pike

---------------
The class eZContentObjectTreeNode does.

Damien Pobel

Thursday 11 October 2007 5:08:09 am

Hi *-pike,

I think you won't really improve performances of your site by decreasing the size of the override.ini and its cache.
Instead, you should have a look at articles [1] and forum topics [2] about performances problems. There's simple things to do like installing an opcode cache (like eAccelerator or APC) and more difficult like templates optimizations.

[1] http://ez.no/developer/articles/ez_publish_performance_optimization_part_3_of_3_practical_cache_and_template_solutions
[2] http://ez.no/developer/forum/general/ez_publish_performance_optimisation_faq

Damien
Planet eZ Publish.fr : http://www.planet-ezpublish.fr
Certification : http://auth.ez.no/certification/verify/372448
Publications about eZ Publish : http://pwet.fr/tags/keywords/weblog/ez_publish

*- pike

Thursday 11 October 2007 8:50:09 am

Hi Damian

that second link is extremely usefull !!

for the first link, we've looked at / tried / tested / measured most of the options. and we did have some improvement. nevertheless, performance is bad again and dropping as we grow.

my remaining question would be: how much would the performance drop if, instead of using override.ini for matching templates by Class ID, I just put the templates on the right place, like in /design/mydesign/templates/node/view/line/article.tpl ?

because I actually prefer the second method :-)
unless it slows everything down ofcourse.

thanks!
*-pike

---------------
The class eZContentObjectTreeNode does.

*- pike

Tuesday 12 February 2008 12:10:25 pm

just for future readers:

I did have something wrong here. ezpublish doesnt 'just expect' to find a line view for a article in

/design/mydesign/templates/node/view/line/article.tpl

If you explicitly request a

{node_view_gui view="line"}

, ezpublish will look for a template somewhere called node/view/line.tpl. amongst others, it will look in

/design/mydesign/templates/node/view/line.tpl

if there happens to be an entry in override.ini for node/view/line.tpl, for class 'article', it will ofcourse follow whatever that entry says. beware, the base design already gives such overrides.

To limit your override.ini, you can ofcourse put a template at

/design/mydesign/templates/node/view/line.tpl

and add a switch in there that does something special for class "article". but such a switch is similar to what appears in override.ini after it is compiled (however, it won't be parsed at each request - so i think its more efficient).

If you (like me) are then tempted to write line templates that look like

{switch $class}
  {case $cx}{include uri="$ux"}{/case}
  {case $cy}{include uri="$uy"}{/case}
{/switch}

bear in mind, that includes are again less efficient..

*-pike

---------------
The class eZContentObjectTreeNode does.

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 31 2025 00:32:18
Script start
Timing: Jan 31 2025 00:32:18
Module start 'layout'
Timing: Jan 31 2025 00:32:18
Module start 'content'
Timing: Jan 31 2025 00:32:18
Module end 'content'
Timing: Jan 31 2025 00:32:18
Script end

Main resources:

Total runtime0.0293 sec
Peak memory usage4,096.0000 KB
Database Queries3

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0055 588.2500151.2266
Module start 'layout' 0.00550.0059 739.4766220.7188
Module start 'content' 0.01150.0162 960.19531,005.9297
Module end 'content' 0.02760.0016 1,966.125041.9922
Script end 0.0292  2,008.1172 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00279.3293140.0002
Check MTime0.00123.9756140.0001
Mysql Total
Database connection0.00072.557510.0007
Mysqli_queries0.004314.862330.0014
Looping result0.00010.188310.0001
Template Total0.00113.810.0011
Template load0.00093.035910.0009
Template processing0.00020.780010.0002
Override
Cache load0.00062.013010.0006
General
dbfile0.003712.784880.0005
String conversion0.00000.034240.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