Left menu best practise

Author Message

Sander van den Akker

Wednesday 30 December 2009 7:42:31 am

I am facing a design question regarding the left menu in a new project. In the website interface, as well as some of my previous projects, menu includes are located inside the pagelayout template. Whether it is shown, and when, is configured in menu.ini.

Wouldn't it be more flexible on object level (and also cleaner) to include menu templates inside the appropriate full templates, instead of working with many ini settings and the persistent_variable? Or will this cause cache or performance problems?

eZ Publish certified developer
http://auth.ez.no/certification/verify/392313

Nicolas Pastorino

Tuesday 26 January 2010 3:26:53 am

Hi Sander,

Having the left menu in the view template means the menu will be view-cached, on a per-node basis. This means that whenever you want to change the content of your menu (adding a menu entry for example), you will need to clear all nodes' view cache...which is not recommended :) Another con is that regenerating a node's view cache will take longer for it needs to compute the left menu on top of its own content.

Now that the persistent_variable exists and works fine, information passing between view templates and the pagelayout is actually pretty easy. This can allow for a highly contextual menu. In terms of performance optimization, cache-blocks can be used around the menu, using the appropriate keys and options to have it expire when it is required.

As to the use of menu.ini, it is no dogma. It is indeed shipped with eZ Publish, but its usage is, as most of the other solutions shipped (eZ Flow, eZ Webin), simply an example onhow to best use the features. You may decide to not use it, alleviating some ini configuration.

Hope it helps. Interested in knowing how you actually solved the issue (as your initial post dates a bit).
Cheers and thanks for triggering this discussion,

--
Nicolas Pastorino
Director Community - eZ
Member of the Community Project Board

eZ Publish Community on twitter: http://twitter.com/ezcommunity

t : http://twitter.com/jeanvoye
G+ : http://plus.tl/jeanvoye

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:30
Script start
Timing: Jan 29 2025 14:41:30
Module start 'layout'
Timing: Jan 29 2025 14:41:30
Module start 'content'
Timing: Jan 29 2025 14:41:30
Module end 'content'
Timing: Jan 29 2025 14:41:30
Script end

Main resources:

Total runtime0.0104 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.0038 589.2578151.2109
Module start 'layout' 0.00380.0019 740.468836.6484
Module start 'content' 0.00570.0036 777.117290.3125
Module end 'content' 0.00930.0011 867.429733.9922
Script end 0.0103  901.4219 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002019.2114140.0001
Check MTime0.00098.6792140.0001
Mysql Total
Database connection0.00065.862710.0006
Mysqli_queries0.001716.107630.0006
Looping result0.00000.087410.0000
Template Total0.00088.210.0008
Template load0.00076.306510.0007
Template processing0.00021.843910.0002
Override
Cache load0.00054.386710.0005
General
dbfile0.00022.066980.0000
String conversion0.00000.059840.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