Thursday 26 March 2009 9:13:19 pm
Pablo, When you think about it, it's only obvious it won't work. I don't know how your website works, but I assume you have a flat main menu and a multi-level contextual submenu. Let's say there are 10 main categories for main menu, and each category contains 20 pages with links for each page. This gives a total of 200 pages, right? Now, you've placed submenu cache block, with its keys, within the main menu cache block. Main menu has 10 combinations, submenu has 200 combinations. When do you expect the submenu to have a chance to refresh? {* This won't work! *}
{cache-block keys=$mainmenu_keys}
{MENU HERE}
{SUBMENU HERE}
{/cache}
If you need to have both menus packed into one cache-block, you have set expiry keys combination that would serve the smalles possible entity, in this case a submenu item: {* This should work! *}
{cache-block keys=$submenu_keys}
{MENU HERE}
{SUBMENU HERE}
{/cache}
We hardly ever can do without two separate cacheblocks, one for main menu, one for submenu: {* This works! *}
{cache-block keys=$mainmenu_keys}
{MENU HERE}
{/cache}
{cache-block keys=$submenu_keys}
{SUBMENU HERE}
{/cache}
This approach gives you the possibility to further optimize your menus separately! For $mainmenu_keys you only need an array of 10 node combinations + one combination for all other tools (login, edit, etc.). For many websites it is not necessary to have all the nodes in the menu. Usually, you place navigation/folder-like items to act as a menu, while multiple articles are never shown there, only in the breadcrumb navigation.
Imagine this scenario: your website has:
- 10 main menu categories
- 200 submenu categories - 10000 articles If you base your menu cache on the entire path, you will end up with at least 10210 cache files stored in your cache directory for a menu that only has 200 combinations! You're most likely to be forced to clear your cache-blocks before it ever gets completely generated ;) What you can do is calculate proper cache-block exipry keys based on depth, class, etc. So that they really reflect what's going on in your menu.
--
Company: mediaSELF Sp. z o.o., http://www.mediaself.pl
eZ references: http://ez.no/partners/worldwide_partners/mediaself
eZ certified developer: http://ez.no/certification/verify/272585
eZ blog: http://ez.ryba.eu
|