Share » Forums » Developer » Custom Tool Trouble

Custom Tool Trouble

Custom Tool Trouble

Tuesday 13 December 2005 2:19:24 am - 2 replies

Author Message

Bruce Morrison

Tuesday 13 December 2005 3:03:28 am

Hi Fraser

I think this is an with the cache. When you first view he page after the cache has been cleared $node is set. On the second viewing the cached version of the page is used. In the cached version $node is not retrieved (and not set) - this is the purpose of the cache, to save unnecessary database access. Of course this doesn't help you much ;)

If you are viewing a page with a node (pages like search results or the shop do not have a node_id) you will have to retrieve it first.

{* Toolbar - Related *}
{if is_set($module_result.content_info)}
  {def $current_node = fetch(content,node,hash(node_id,$module_result.content_info.node_id))}
  {if is_set($current_node.object.data_map.keywords.content)}
<div class="toolbar-item {$placement}">
    {def $related_nodes=$current_node.object.data_map.keywords.content.related_nodes}
<div class="toollist">
<div class="toollist-design">
<h2>{$title}</h2>
<div class="content-view-children">
      {foreach $related_nodes as $related_node}
<p>{node_view_gui view=listitem content_node=$related_node}</p>
      {/foreach}
</div>
</div>
</div>
</div>
    {undef $current_node}
  {/if}
  {undef $related_nodes}
{/if}

Cheers
Bruce

My Blog: http://www.stuffandcontent.com/
Follow me on twitter: http://twitter.com/brucemorrison
Consolidated eZ Publish Feed : http://friendfeed.com/rooms/ez-publish

Fraser Hore

Tuesday 13 December 2005 5:42:44 am

Your code works great! Thanks a lot Bruce! I appreciate your help.

I'm still a litte confused as to why the node isn't available in the tool template. When i use my old code in the node/view/full template it works fine.

Fetching the node in the tool template did seem to slow things down a bit.

Cheers,

Fraser

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu