Forums / Setup & design / Nodes NOT caching!

Nodes NOT caching!

Author Message

Douglas Johnson

Tuesday 14 October 2003 7:31:47 am

All of my navigation (nodes) disappears with viewcaching enabled. NodeTreeCaching is enabled. Please help.

Alex Jones

Tuesday 14 October 2003 8:33:06 am

As per http://ez.no/developer/ez_publish_3/documentation/customization/custom_design/caching/variables_in_cached_templates

$node is not available with ViewCaching=enabled

$module_result is available with ViewCaching=enabled

You will need to update your code to avoid the use of $node in your navigation.

Alex

Alex
[ bald_technologist on the IRC channel (irc.freenode.net): #eZpublish ]

<i>When in doubt, clear the cache.</i>

Douglas Johnson

Tuesday 14 October 2003 9:24:46 am

Here's what I'm using:

{let left_list=fetch( content, tree, hash(parent_node_id, $module_result.node_id, limit, 23,sort_by, array(modified,true()), class_filter_type, include, class_filter_array, array(2)))}
{section name=Leftmenu loop=$left_list}
{switch name=Sw1 match=$node.name}
{case match="About Metal-Fab"}
<a href={concat("/content/view/full/", $Leftmenu:item.node_id, "/")|ezurl}>
<br>{$Leftmenu:item.name}<br>
</a>
{/case}
{/switch}
{/section}
{/let}

This is not displayed when viewcach is enabled. Does this mean I will need to re-write all of my pagelayouts? If so, what is the code I should use?

Paul Borgermans

Tuesday 14 October 2003 12:16:28 pm

Try surrounding your pagelayout template "body" by

{let thisnode=fetch('content','node',hash('node_id',$module_result.node_id))}

.....replace $node with $thisnode .....

.....at the end of your template .....
{/let}

You can safely turn on viewcaching now

hth

-paul

eZ Publish, eZ Find, Solr expert consulting and training
http://twitter.com/paulborgermans

Paul Borgermans

Tuesday 14 October 2003 12:21:19 pm

... in the template coding classroom:

Increase the speed by putting cache-blocks around your menus with the cache-block key array containing the current node id (and also the current user if you have roles for different users)

;-)

-paul

eZ Publish, eZ Find, Solr expert consulting and training
http://twitter.com/paulborgermans