Les avertissements suivants se sont produits :
Warning [2] Undefined array key 0 - Line: 1640 - File: showthread.php PHP 8.2.18 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/showthread.php 1640 errorHandler->error_callback
/showthread.php 915 buildtree




Note de ce sujet :
  • Moyenne : 0 (0 vote(s))
  • 1
  • 2
  • 3
  • 4
  • 5
[Résolu]sous menu horizontal apparent sur les pages
#17
Tu n'as pas choisi le plus facile Wink
L'algorithme n'est pas optimisé, mais ça tourne.
Voir en action : http://www.menus-cmsms-madesimple.be/men...fant2.html
Le code est valide sous IE5.5 -> IE7 mais je n'ai pas pu tester sur IE8 (faudra peut-être modifier les commentaires conditionnels <!--[if IE 7]>)
Code :
{if $count > 0}
<div id="nav">
{assign var="parentActif" value=0}
{foreach from=$nodelist item=node}
{if $node->index == 0}{assign var="prevnode" value=$node}{/if}
{assign var='current' value='<ul class="sub">'}
{if $node->current or $node->parent}{assign var="parentActif" value=$node->hierarchy|truncate:2:""}{/if}
{if $node->depth > $node->prevdepth}
     {if $prevnode->parent or $prevnode->current}{assign var="current" value='</li></ul><ul class="sub_active">'}
     {/if}
{$current}
{elseif $node->depth < $node->prevdepth and $prevnode->hierarchy|truncate:2:"" != $parentActif}
{repeat string='</li></ul><!--[if lte IE 6]></td></tr></table></a><![endif]--></li>' times=$node->prevdepth-$node->depth}
{elseif $node->depth < $node->prevdepth and $node->hierarchy|truncate:2:"" == $parentActif}
{repeat string='</li></ul>' times=$node->prevdepth-$node->depth}
{elseif $node->index > 0  and ($node->current == false and !$node->parent)}
</li>
{elseif $node->index > 1 }</li>
{/if}
{if $node->depth == 1 and ($node->current or $node->parent) and $node->index > 0}
</ul><ul class="current">
{elseif $node->depth == 1 and  ($node->current or $node->parent) and $node->index == 0}
<ul class="current">
{elseif $node->depth == 1 and $node->index > 0 and $node->hierarchy|truncate:2:"" != $parentActif}
</ul><ul class="select">
{elseif $node->depth == 1}
<ul class="select">
{/if}
{if $node->parent or ($node->current and $node->haschildren)}
<li class="menuactive menuparent">
<a class="menuactive menuparent"
{elseif $node->current}
<li class="current_sub">
<a class="menuactive"
{elseif $node->haschildren}
<li class="menuparent">
<a class="menuparent"
{else}
<li>
<a {/if}
{if $node->target}target="{$node->target}" {/if}
{if $node->depth == 1 and $node->hierarchy|truncate:2:"" != $parentActif and $node->haschildren}
href="{$node->url}">{$node->menutext}<!--[if IE 7]><!--></a><!--<![endif]--><!--[if lte IE 6]><table><tr><td><![endif]-->
{elseif $node->depth == 1 and $node->hierarchy|truncate:2:"" == $parentActif}
href="{$node->url}">{$node->menutext}</a>
{else}
href="{$node->url}">{$node->menutext}</a>
{/if}
{assign var="prevnode" value=$node}
{/foreach}
{if !$node->parent}
{repeat string='</li></ul>' times=$node->depth-1}
{/if}
{if $node->hierarchy|truncate:2:"" != $parentActif}<!--[if lte IE 6]></td></tr></table></a><![endif]--></li></ul>{/if}
<div class="clearb"></div>
</div>
{/if}
Appeler le menu avec le paramètre : {menu template='menuLOLO' number_of_levels='2'}

css :
Code :
/* ================================================================
This copyright notice must be untouched at all times.

The original version of this stylesheet and the associated (x)html
is available at http://www.cssplay.co.uk/menus/simple_dropline.html
Copyright (c) 2005-2007 Stu Nicholls. All rights reserved.
This stylesheet and the associated (x)html may be modified in any
way to fit your requirements.
=================================================================== */
/* for this demo only */
#nav {margin:20px 0 80px 0;}

/* the styling */
#nav {width:750px; height:20px; background:#000; position:relative;}

#nav .select, #nav .current {margin:0; padding:0; list-style:none;}

#nav li {display:inline; margin:0; padding:0; height:auto;}

#nav .select a,
#nav .current a {display:block; height:20px; float:left; background:#000; padding:0 10px 0 10px; text-decoration:none; font-size:12px; line-height:20px; white-space:nowrap; border-right:1px solid #fff; color:#fff;}
* html #nav .select a, * html #nav .current a {width:1px; height:21px;}


#nav .select a:hover,
#nav .select li:hover a {background:#888; cursor:pointer; color:#ff0;}

#nav .sub {display:none;}

/* for IE5.5 and IE6 only */
#nav table {position:absolute; border-collapse:collapse; left:0; top:0;}

#nav .current a {background:#666; color:#ff0;}


#nav .sub li a:hover,
#nav .select a:hover .sub li a:hover,
#nav .select li:hover .sub li a:hover {background:#888; color:#ff0;}

#nav .sub_active .current_sub a,
#nav .sub_active a:hover {background:#666; color:#ff0;}

#nav .select li a:hover .sub,
#nav .select li:hover .sub {display:block; position:absolute; width:750px; top:20px; left:0; background:#888; margin-top:0; padding:0; z-index:100; color:#fff; font-size:11px;}

#nav .sub, #nav .sub_active {margin:0; padding:0; list-style:none;}

#nav .sub_active {display:block; position:absolute; width:750px; top:20px; left:0; background:#666; margin-top:0; padding:0; z-index:10;}
* html #nav .sub_active, * html #nav .select a:hover .sub {z-index:-1; margin-top:0; margin-t\op:1px;}

#nav .sub_active a {height:21px; text-decoration:none; line-height:20px; white-space:nowrap; display:block; float:left; background:#666; padding:5px 10px 10px 10px; margin:0; font-size:12px; white-space:nowrap; border:0; color:#fff;}

#nav .select a:hover .sub li a,
#nav .select li:hover .sub li a {display:block; background:#888; padding:5px 10px 10px 10px; margin:0; white-space:nowrap; border:0; color:#fff; font-size:12px;}


Messages dans ce sujet

Atteindre :


Utilisateur(s) parcourant ce sujet : 1 visiteur(s)