eZ Community » Forums » Setup & design » Left menu with ViewCaching=true
expandshrink

Left menu with ViewCaching=true

Left menu with ViewCaching=true

Saturday 29 March 2003 7:23:21 pm - 4 replies

Hi,

My left_menu.tpl (in the bottom), that i include in pagelayout.tpl, creates an menu with diferent <div> if the section of each node is the same of the actually show node. This executes well if ViewCaching=false. If true give same <div> for all nodes.
Can anyone help me? ViewCaching true is much speedy, so i want try to get a solution without turning it to false, and without making a left_menu static, is it possible?

Thank in advance

Paulo Almeida

left_menu.tpl

{let children=fetch('content','list',hash(parent_node_id,40))}

{* loop children and print name with link *}
{section name=Child loop=$children}
{switch name=sw match=$Child:item.object.section_id}

{case match=$node.object.section_id}
<div class="menuon">
{/case}
{case}
<div class="menuoff">
{/case}
{/switch}
<a href={$Child:item.url_alias|ezurl}>{$Child:item.name}</a>
</div>
{/section}

{/let}

Sunday 30 March 2003 5:19:33 am

Well i found the solution by myself.
1º the script doesn't worked because with ViewCaching=true the variable $node doesn't exist

2º i can get section_id in variable $module_result, so i don't need $node anymore

3º i found a better way to implement like this:

{let children=fetch('content','list',hash(parent_node_id,40))}
{section name=Child loop=$children}
<div class="menu{cond($module_result.section_id|eq($Child:item.object.section_id),"on","off"blunk.gif Emoticon}">
<a href={$Child:item.url_alias|ezurl}>{$Child:item.name}</a>
</div>
{/section}

Regards
Paulo Almeida

Monday 31 March 2003 9:32:04 am

Paulo,

You can also use $DesignKeys:used.node To view all DesignKeys use this in the body of your document {$DesignKeys:used|attribute(show, 1)} to show all the variables available.

I hope this helps

Tony

Monday 31 March 2003 7:22:36 pm

Hi

$DesignKeys:used.node is the id, with this i need to fetch the node to get section_id. With $module_result.section_id, is "direct".

Thanks
Paulo Almeida

Thursday 12 June 2003 4:40:32 pm

Hello,

I've solved it using a big
{let node=fetch('content','node',hash(node_id,$DesignKeys:used.node)) }

...

{/let}
around my whole pagelayout.tpl

Mads Buus Jensen

expandshrink

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

36 542 Users on board!

Forums menu