View Single Post
  #7  
Old 09-09-2007, 05:38 AM
  DogByteMan's Avatar 
DogByteMan DogByteMan is offline
 

X-Adept
  
Join Date: Mar 2003
Posts: 833
 

Default Re: 4 Level SEO friendly Flyout Menus - 4.1.x compatible

I cleared everything but the server and the kitchen sink but still no luck... Here is what I have done

I created a folder within skin1 called menu

In skin1/menu I added the following files

I created a file named menu.tpl and placed the following code into it:
Code:
{assign var=subcatSymbol value='<b id="floatingBold">+</b>'} <ul id="navmenu"> {foreach from=$categories item=level_one name="Root"} {assign var=one value=$level_one.categoryid} {if $level_one.parentid eq 0 and $level_one.avail eq "Y"} <li><a href="home.php?cat={$level_one.categoryid}">{if $level_one.subcategory_count gt 0}{$subcatSymbol}{/if}{$level_one.category|escape:'html'}</a> {if $level_one.subcategory_count gt 0} <ul> {foreach from=$allsubcategories.$one item=level_two name="Level_Two"} {assign var=two value=$level_two.categoryid} {if $level_two.avail eq "Y"} <li><a href="home.php?cat={$level_two.categoryid}">{if $allsubcategories.$two ne ''}{$subcatSymbol}{/if}{$level_two.category|escape:'html'}</a> {if $allsubcategories.$two ne ''} <ul> {foreach from=$allsubcategories.$two item=level_three name="Level_Three"} {assign var=three value=$level_three.categoryid} {if $level_three.avail eq "Y"} <li><a href="home.php?cat={$level_three.categoryid}">{if $allsubcategories.$three ne ''}{$subcatSymbol}{/if}{$level_three.category|escape:'html'}</a> {if $allsubcategories.$three ne ''} <ul> {foreach from=$allsubcategories.$three item=level_four name="Level_Four"} {if $level_four.avail eq "Y"} <li><a href="home.php?cat={$level_four.categoryid}">{$level_four.category|escape:'html'}</a></li> {/if} {/foreach} </ul> {/if} </li> {/if} {/foreach} </ul> {/if} </li> {/if} {/foreach} </ul> {/if} </li> {/if} {/foreach} </ul>

I created a file named menu.css and placed the following code into it:
(I think alltribes site is cool, so no slight to him, but I changed this)
Code:
/* Root = Vertical, Secondary = Vertical */ ul#navmenu, ul#navmenu li, ul#navmenu ul { margin: 0; border: 0px none; padding: 0; width: 148px; /*For KHTML*/ list-style-type:none } ul#navmenu:after /*From IE 7 lack of compliance*/{ clear: both; display: block; font: 1px/0px serif; content: "."; height: 0; visibility: hidden; } ul#navmenu li { float: left; /*For IE 7 lack of compliance*/ display: block !important; /*For GOOD browsers*/ display: inline; /*For IE*/ position: relative; } /* Root Menu */ ul#navmenu a { border: 1px solid #FFF; border-right-color: #CCC; border-bottom-color: #CCC; padding: 0 0px; display: block; background: #EEE; color: #000; font-size: 10px; text-decoration: none; height: auto !important; height: 1%; /*For IE*/ } /* Root Menu Hover Persistence */ ul#navmenu a:hover, ul#navmenu li:hover a, ul#navmenu li.iehover a { background: #CCC; color: #FFF; } /* 2nd Menu */ ul#navmenu li:hover li a, ul#navmenu li.iehover li a { background: #EEE; color: #000; } /* 2nd Menu Hover Persistence */ ul#navmenu li:hover li a:hover, ul#navmenu li:hover li:hover a, ul#navmenu li.iehover li a:hover, ul#navmenu li.iehover li.iehover a { background: #CCC; color: #FFF; } /* 3rd Menu */ ul#navmenu li:hover li:hover li a, ul#navmenu li.iehover li.iehover li a { background: #EEE; color: #000; } /* 3rd Menu Hover Persistence */ ul#navmenu li:hover li:hover li a:hover, ul#navmenu li:hover li:hover li:hover a, ul#navmenu li.iehover li.iehover li a:hover, ul#navmenu li.iehover li.iehover li.iehover a { background: #CCC; color: #FFF; } /* 4th Menu */ ul#navmenu li:hover li:hover li:hover li a, ul#navmenu li.iehover li.iehover li.iehover li a { background: #EEE; color: #000; } /* 4th Menu Hover */ ul#navmenu li:hover li:hover li:hover li a:hover, ul#navmenu li.iehover li.iehover li.iehover li a:hover { background: #CCC; color: #FFF; } ul#navmenu ul, ul#navmenu ul ul, ul#navmenu ul ul ul { display: none; position: absolute; top: 0; left: 160px; } /* Do Not Move - Must Come Before display:block for Gecko */ ul#navmenu li:hover ul ul, ul#navmenu li:hover ul ul ul, ul#navmenu li.iehover ul ul, ul#navmenu li.iehover ul ul ul { display: none; } ul#navmenu li:hover ul, ul#navmenu ul li:hover ul, ul#navmenu ul ul li:hover ul, ul#navmenu li.iehover ul, ul#navmenu ul li.iehover ul, ul#navmenu ul ul li.iehover ul { display: block; } #floatingBold { float: right; margin-right: 2px; }
Note at the bottom the added #floatingBold css

I created a file named menu.js and placed the following code into it:
Code:
navHover = function() { var lis = document.getElementById("navmenu").getElementsByTagName("LI"); for (var i=0; i<lis.length; i++) { lis[i].onmouseover=function() { this.className+=" iehover"; } lis[i].onmouseout=function() { this.className=this.className.replace(new RegExp(" iehover\\b"), ""); } } } if (window.attachEvent) window.attachEvent("onload", navHover);

Just before </head> in customer/home.tpl I placed this code:
Code:
<link rel="stylesheet" href="{$SkinDir}/menu/menu.css" type="text/css" /> <!--[if gte IE 5.5]> <script language="JavaScript" src="{$SkinDir}/menu/menu.js" type="text/JavaScript"></script> <![endif]-->

And I replaced also in customer/home.tpl:
Code:
{include file="customer/categories.tpl"}

With:
Code:
{include file="menu/menu.tpl"}

I also made sure the following exists at the top of /skin1/customer/home.tpl:
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

In /home.php I made the following changes:

Find:
Code:
define('OFFERS_DONT_SHOW_NEW',1); require "./auth.php";

After, add:
Code:
/* Makes fly-out menus show all levels properly */ define("GET_ALL_CATEGORIES", true);

OK... now you have it. Where did I go wrong?
__________________
Dedicated Server provided by EWD Hosting
X-Cart version 4.1.12
PHP 5.3.2
MySQL server 5.0.87-community
Operation system Linux
Perl 5.008008
dogbytecomputer.com
Reply With Quote