Friday 27 January 2006 2:28:34 am
Hi Massimo, the problem with your code is the following: In the cache block you are using variable $node (for example in sub($node.depth,1)). This variable does not exist when the <i>content/view</i> view will use the cached version of the page (understand the result from the <i>content/view</i> view = the output of <i>/node/view/full.tpl</i> or its override). When you remove the caches and you are accessing a page the first time, eZp has to render <i>/node/view/full.tpl</i> (or its override) first and the template system creates $node (which you are using in the template). The rendered page is then stored in the cache and the template system continues with rendering <i>pagelayout.tpl</i>. Because the cache-block does not exist, the code is processed and everything is fine because the template system still remembers the $node variable. But once the cache-block has expired (= in 2 hours) and the template systems tries to process the code (of the cache-block) once again, the cached version of the page is used and that's why there is no $node. <b>Solution: do not use $node.depth. Use $module_result.content_info.node_depth instead.</b> Recommendation: there is no need to expire cache block in the time domain. Use expiry="0" in the cache-block. The cache-block will expiry only when any content on the site is (re-)published. (You can go even further and try to use the subtree_expiry parameter.)
Jan Kudlicka | System Developer @ Grenland Web | http://www.grenlandweb.no
|