Sticky navigation

Author Message

David Jones

Monday 02 October 2006 2:32:33 am

I've got some sub navigation on my site that extends to 2 levels.

I've coded this into my pagelayout.tpl like so.

<ul>
{foreach $pagelayout_node.children as $child}
	<li><a href={$child.url_alias|ezurl}>{$child.name}</a>
		<ul>
			{foreach $child.children as $child_subnav}
			<li><a href="{$child_subnav.url_alias|ezurl}}">{$child_subnav.name}</a></li>
		       {/foreach}
		</ul>
        </li>
{/foreach}
</ul>

This works fine. However, when I click on a child node I lose the top level. I would like this to still be display.

Let's see if i can explain this a little. My navigation is something like below:

1
-- 1.1
-- 1.2
2
- 2.1
- 2.2
3
4
- 4.1

When I click 1.1 the top level all disappears on the page. So I can't go back up the tree. I would like the navigation tree to remain constant independant of the level i am on.

Did that make any sense?

Marco Zinn

Monday 02 October 2006 9:12:18 am

Eh... yes, it makes sense.
I guess, $pagelayout_node contains the current node, so you will only display the current node's children with your code.
You should probably use a hard-coded node (Node 2, for example), if you want to have a "static" menu.

But: Why don't you use the provided menus or the treemenu code/template?

Marco
http://www.hyperroad-design.com

David Jones

Monday 09 October 2006 4:55:47 am

Thanks Marco,

But could you be a little more spcific?

How could I use the Tree code template?

Thanks

David Jones

Monday 09 October 2006 5:35:55 am

OK, I found some code in the documentation that seems to claim to do what I want however, when I put it in pagelayout.tpl it doesn't output anything.

{def $mainMenu=treemenu( $module_result.path, $module_result.node_id ) }
{foreach $mainMenu as $menu}

{$menu.level} - {$menu.text}<br />
{/foreach}
{undef $mainMenu}

Any idea what I'm missing?

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 31 2025 01:30:32
Script start
Timing: Jan 31 2025 01:30:32
Module start 'layout'
Timing: Jan 31 2025 01:30:32
Module start 'content'
Timing: Jan 31 2025 01:30:32
Module end 'content'
Timing: Jan 31 2025 01:30:32
Script end

Main resources:

Total runtime0.0225 sec
Peak memory usage6,144.0000 KB
Database Queries3

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0049 588.0156151.1953
Module start 'layout' 0.00490.0034 739.2109220.6719
Module start 'content' 0.00830.0128 959.8828997.8984
Module end 'content' 0.02110.0014 1,957.781333.9922
Script end 0.0225  1,991.7734 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002712.1804140.0002
Check MTime0.00114.7974140.0001
Mysql Total
Database connection0.00072.890510.0007
Mysqli_queries0.00188.166530.0006
Looping result0.00000.062510.0000
Template Total0.00104.610.0010
Template load0.00083.632710.0008
Template processing0.00020.977310.0002
Override
Cache load0.00052.269010.0005
General
dbfile0.00114.949980.0001
String conversion0.00000.030740.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs