Forums / Setup & design / Showing third menu level

Showing third menu level

Author Message

DeAndre Johnson

Sunday 27 September 2009 10:40:49 pm

I have a custom and complex dropdown menu that shows at once the second level, third level, and featured items in the dropdown. The dropdown is broken down into sections like "base (second level), center (third level), left (featured). What I what to do is show in "center" section of dropdown the third level items. Basically if a second level menu item has a third level. I want that to be displayed in center section of dropdown. It's kinda confusing to explain so here's some menu code.

<div id="nav">
  <ul id="menulist">
{def $goleft = ezini( 'TopDrop', 'goleft', 'design.ini' )
	 $item_class = array()
	 $root_node = fetch( 'content', 'node', hash( 'node_id', 2 ) ) 
	 $top_items = fetch( 'content', 'list', hash( 'parent_node_id', $root_node.node_id,

				'class_filter_type', 'include',
				'class_filter_array', array( 1, 11, 19, 23, 44 ),
				'sort_by', $root_node.sort_array ) )

	 $top_items_count = $top_items|count()
	 $children = 0
	 $featured = 0
	 $current_node_in_path = first_set($pagedata.path_array[1].node_id, 0  )
     $current_node_in_path_2 = first_set($pagedata.path_array[2].node_id, 0  )
       $current_node_in_path_3 = first_set($pagedata.path_array[3].node_id, 0  )}
	
{if $top_items_count}
	{foreach $top_items as $key => $item}
		{set $item_class = array()}
		{if $current_node_in_path|eq($item.node_id)}
            {set $item_class = array("selected")}
		{/if}
		{set $children = fetch( 'content', 'list', hash( 'parent_node_id', $item.node_id,

				'class_filter_type', 'include',
				'class_filter_array', array( 1, 11, 19, 23, 44 ),
				'sort_by', $item.sort_array ) ) }
		
		{if $key|eq(0)}
            {set $item_class = $item_class|append("firstli")}
        {/if}
        {if $top_menu_items_count|eq( $key|inc )}
            {set $item_class = $item_class|append("lastli")}
        {/if}
        {if $item.node_id|eq( $current_node_id )}
            {set $item_class = $item_class|append("current")}
        {/if}
    {* exclude utility node from menu *}
		{if $item.node_id|ne(162)}
    <li id="{$item.name|explode('&')|implode('_')|explode(' ')|implode('')}" {if $item_class} class="{$item_class|implode(" ")}"{/if}><a id="{$item.name}" class="menu {$item.name}" href={$item.url_alias|ezurl}>{$item.name}</a>
    {/if}
    {if $children|count()|gt(0)}
			{* SECOND LEVEL *}
      <ul>
        <li>
          <div id="m-panel-{$item.name}" class="m-panel">
            <ul class="colBase">
            {foreach $children as $key => $child_item}
						{set $item_class = array()}
                {if $current_node_in_path_2|eq($child_item.node_id)}
                    {set $item_class = array("selected")}
                {/if}
                {if $key|eq(0)}
                    {set $item_class = $item_class|append("firstli")}
                {/if}
                {if $children|count|eq( $key|inc )}
                    {set $item_class = $item_class|append("lastli")}
                {/if}
                {if $child_item.node_id|eq( $current_node_id )}
                    {set $item_class = $item_class|append("current")}
                {/if}
              <li {if $item_class} class="{$item_class|implode(" ")}"{/if}><a {if $children|count()|gt(0)}{/if} href={$child_item.url_alias|ezurl}>{$child_item.name}
              </a></li>
              {/foreach}
            </ul>

{* THIS IS WHERE THE PROBLEM BEGINS *}
             {* THIRD LEVEL *}
            <ul class="centerCol first">
              <ul class="colLeft split">
              	<li class="firstli"><span>{$child_item.name}</span></li>{* THIS SHOULD DISPLAY SECOND LEVEL ITEM NAME THAT HAS THIRD LEVEL  *}
              {foreach $children as $key => $child_item}
							{set $item_class = array()}
                	{if $current_node_in_path_3|eq($child_item.node_id)}
                    	{set $item_class = array("selected")}
                	{/if}
                	{if $children|count|eq( $key|inc )}
                    {set $item_class = $item_class|append("lastli")}
                	{/if}
                {* THIS SHOULD OUTPUT THIRD LEVEL ITEMS *}
                <li {if $item_class} class="{$item_class|implode(" ")}"{/if}><a {if $children|count()|gt(0)}{/if} href={$child_item.url_alias|ezurl}>{$child_item.name}</a></li>
                {/foreach}
              </ul>
              <ul class="colLeft">
                <li class="firstli"><span>{$child_item.name}</span></li>{* THIS SHOULD DISPLAY SECOND LEVEL ITEM NAME THAT HAS THIRD LEVEL  *}
              {foreach $children as $key => $child_item}
							{set $item_class = array()}
                	{if $current_node_in_path_3|eq($child_item.node_id)}
                    	{set $item_class = array("selected")}
                	{/if}
                	{if $key|eq(0)}
                    	{set $item_class = $item_class|append("firstli")}
                	{/if}
                	{if $children|count|eq( $key|inc )}
                    {set $item_class = $item_class|append("lastli")}
                	{/if}
                	{if $child_item.node_id|eq( $current_node_id )}
                    	{set $item_class = $item_class|append("current")}
                {/if}
                {* THIS SHOULD OUTPUT THIRD LEVEL ITEMS *}
                <li {if $item_class} class="{$item_class|implode(" ")}"{/if}><a {if $children|count()|gt(0)}{/if} href={$child_item.url_alias|ezurl}>{$child_item.name}</a></li>
                {/foreach}
              </ul>
            </ul>
{* THIS IS WHERE THE PROBLEM ENDS *}

            {* FEATURE ITEM *}
            <ul class="centerCol last">
              <ul class="colLeft split">
              	<li class="first"> <span>Featured</span> </li>            
              	{set $featured = fetch( 'content', 'list', hash( 'parent_node_id', $item.node_id,
																 'class_filter_type', 'include',
																 'class_filter_array', array( 'article_mainpage' ),
																 'limit', 1,
																 'depth', 2,
																 'sort_by', array( 'published', false() ) ) ) }

								{if $featured|count|gt(0)}
                <li> <a href={$featured.0.url_alias|ezurl} title="Featured"> Feature of the Month
			{attribute_view_gui attribute=$featured.0.data_map.image image_class=articlelist}
			</a> 
      					</li>
                {/if}
              </ul>
            </ul>
          </div>
        </li>
      </ul>
    {/if}
    </li>
    {delimiter}
    <li class="divider">/</li>
    {/delimiter}
  {/foreach}
{/if}
  </ul>
</div>


This code outputs this for third level menu items

{* THIS IS WHERE THE PROBLEM BEGINS *}
{* THIRD LEVEL *}
<ul class="centerCol first">
<ul class="colLeft split">
<li class="firstli"><span>defexclusive-interviews, music, videos & more</span></li>
<li><a href="/public/culture/latest">Latest</a></li>
<li><a href="/public/culture/feature">Feature</a></li>
<li><a href="/public/culture/hip-hop-corner">Hip Hop Corner</a></li>
<li class="lastli"><a href="/public/culture/defexclusive-interviews-music-videos-more">defexclusive-interviews, music, videos & more</a></li>
</ul>
<ul class="colLeft">
<li class="firstli"><span>defexclusive-interviews, music, videos & more</span></li>
<li class="firstli"><a href="/public/culture/latest">Latest</a></li>
<li><a href="/public/culture/feature">Feature</a></li>
<li><a href="/public/culture/hip-hop-corner">Hip Hop Corner</a></li>
<li class="lastli"><a href="/public/culture/defexclusive-interviews-music-videos-more">defexclusive-interviews, music, videos & more</a></li>
</ul>
</ul>
{* THIS IS WHERE THE PROBLEM ENDS *}

I want it to output something like this

<ul class="centerCol first">
<ul class="colLeft split">
{* Second level item name *}
<li class="firstli"> <span>Hip-Hop Corner</span> </li>
{* Third level items *}
<li> <a href="#">Say Word?</a> </li>
<li> <a href="#">More Than Just Music</a> </li>
<li> <a href="#">Daily Sound-Off</a> </li>
</ul>
<ul class="colLeft">
{* Second level item name *}
<li class="firstli"> <span>DefExclusives</span> </li>
{* Third level items *}
<li> <a href="#">Interviews</a> </li>
<li> <a href="#">Music, Video's &amp; More</a> </li>
</ul>
</ul>

If anyone can help me with this I would greatly appreciate it.

I am, because I choose to be!

Veronique Jamilloux

Tuesday 20 October 2009 10:18:17 am

hi

I've the same need for my site access. I find this contribution : http://ez.no/developer/contribs/template_plugins/suckerfish_dropdown_menu, with the template and the css file. I don't try it yet, but may you wil find the solution to your problem.
Bye

URGI - INRA
Webmaster
Route de Saint Cyr
78000 Versailles

eZ debug

Timing: Jan 18 2025 11:14:01
Script start
Timing: Jan 18 2025 11:14:01
Module start 'content'
Timing: Jan 18 2025 11:14:02
Module end 'content'
Timing: Jan 18 2025 11:14:02
Script end

Main resources:

Total runtime0.9223 sec
Peak memory usage4,096.0000 KB
Database Queries191

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0086 587.7109180.8359
Module start 'content' 0.00860.7645 768.5469570.8125
Module end 'content' 0.77310.1492 1,339.3594341.0625
Script end 0.9222  1,680.4219 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00440.4735210.0002
Check MTime0.00160.1711210.0001
Mysql Total
Database connection0.00100.103610.0010
Mysqli_queries0.817988.67951910.0043
Looping result0.00190.20421890.0000
Template Total0.883895.820.4419
Template load0.00210.232820.0011
Template processing0.881695.588820.4408
Template load and register function0.00010.012010.0001
states
state_id_array0.00210.231810.0021
state_identifier_array0.00100.105920.0005
Override
Cache load0.00190.2070510.0000
Sytem overhead
Fetch class attribute can translate value0.00150.158730.0005
Fetch class attribute name0.00130.143540.0003
XML
Image XML parsing0.01121.211730.0037
class_abstraction
Instantiating content class attribute0.00000.000740.0000
General
dbfile0.02112.2927330.0006
String conversion0.00000.000630.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
2content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
2content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
6content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
1content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
4content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 17
 Number of unique templates used: 7

Time used to render debug report: 0.0001 secs