View Single Post
  #2  
Old 07-23-2007, 12:35 PM
 
nevets1219 nevets1219 is offline
 

eXpert
  
Join Date: Jun 2006
Posts: 351
 

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

I've followed all the steps but so far all I see in the source is just
Code:
<ul id="navmenu"> </ul>

I've cleared the cache too.

I suggest the following:
Change
Code:
<link rel="stylesheet" href="{$SkinDir}/menu/menu.css">
to
Code:
<link rel="stylesheet" href="{$SkinDir}/menu/menu.css" type="text/css" />
Just added the bolded part.

I'll continue playing around with the code to see what went wrong but if you have any insight please let me know.

EDIT:
I don't see the absolute need for the bolded part because every category should have a categoryid (which is what I'm assuming you are checking for). However, I would recommend a check to see if that category is available (underlined)
Code:
{if $categories[level_one_cat_num].parentid eq 0 and $categories[level_one_cat_num].categoryid and $categories[level_one_cat_num].avail eq "Y"}

SECOND EDIT:
Well, instead of using section, I changed it to foreach (along with some corresponding code changes to allow foreach to work) and it works. However, it's a bit inefficient because essentially you are looping over the $allcategories over and over to display anything with a matching parentid. Hopefully, I didn't use the counter wrong, I just incremented it once everytime the loops run. If you have a large amount of categories, it could hurt.
Code:
<ul id="navmenu"> {assign var=counter value=0} {foreach from=$categories item=level_one_cat name="Root"} {assign var=counter value=$counter+1} {if $level_one_cat.parentid eq 0 and $level_one_cat.avail eq "Y"} <li><a href="home.php?cat={$level_one_cat.categoryid}" alt="{$level_one_cat.category}">{$level_one_cat.category}{if $level_one_cat.subcategory_count gt 0}+{/if}</a> {if $level_one_cat.subcategory_count gt 0} <ul> {foreach from=$allcategories item=level_two_cat name="Level_Two"} {assign var=counter value=$counter+1} {if $level_two_cat.parentid eq $level_one_cat.categoryid} <li><a href="home.php?cat={$level_two_cat.categoryid}" alt="{$level_two_cat.category}">{$level_two_cat.category}{if $level_two_cat.subcategory_count gt 0}+{/if}</a> {if $level_two_cat.subcategory_count gt 0} <ul> {foreach from=$allcategories item=level_three_cat name="Level_Three"} {assign var=counter value=$counter+1} {if $level_three_cat.parentid eq $level_two_cat.categoryid} <li><a href="home.php?cat={$level_three_cat.categoryid}" alt="{$level_three_cat.category}">{$level_three_cat.category}{if $level_three_cat.subcategory_count gt 0}+{/if}</a> {if $level_three_cat.subcategory_count gt 0} <ul> {foreach from=$allcategories item=level_four_cat name="Level_Four"} {assign var=counter value=$counter+1} {if $level_four_cat.parentid eq $level_three_cat.categoryid} <li><a href="home.php?cat={$level_four_cat.categoryid}" alt="{$level_four_cat.category}">{$level_four_cat.category}</a></li> {/if} {/foreach} </ul> {/if} </li> {/if} {/foreach} </ul> {/if} </li> {/if} {/foreach} </ul> {/if} </li> {/if} {/foreach} </ul> COUNTER = {$counter}<br />
For me counter was 673 using this method.

Comparing with the other method I posted in the other thread (I'm still trying to figure out how and why it works because I can't seem to merge it with yours though they are almost identical)
Code:
<ul id="navmenu"> {assign var=counter value=0} {foreach from=$categories item=level_one_cat name="Root"} {assign var=counter value=$counter+1} {assign var=one value=$level_one_cat.categoryid} {if $allsubcategories.$one ne ''} {/if} <li><a href="home.php?cat={$level_one_cat.categoryid}"><b>»</b>{$level_one_cat.category|escape:'html'}</a> {else} <li><a href="home.php?cat={$level_one_cat.categoryid}">{$level_one_cat.category|escape:'html'}</a></li> {/if} {if $allsubcategories.$one ne ''} <ul> {foreach from=$allsubcategories.$one item=level_two_cat name="Level Two"} {assign var=counter value=$counter+1} {assign var=two value=$level_two_cat.categoryid} {if $allsubcategories.$two ne ''} <li><a href="home.php?cat={$level_two_cat.categoryid}"><b>»</b>{$level_two_cat.category|escape:'html'}</a> {else} <li><a href="home.php?cat={$level_two_cat.categoryid}">{$level_two_cat.category|escape:'html'}</a></li> {/if} {if $allsubcategories.$two ne ''} <ul> {foreach from=$allsubcategories.$two item=level_three_cat name="Level Three"} {assign var=counter value=$counter+1} <li><a href="home.php?cat={$level_three_cat.categoryid}">{$level_three_cat.category|escape:'html'}</a></li> {/foreach} </ul> {/if} {if $allsubcategories.$two ne ''} </li> {/if} {/foreach} </ul> {/if} {if $allsubcategories.$one ne ''} </li> {/if} {/foreach} </ul> COUNTER = {$counter}<br />
Counter in this case was only 60.

We can ignore the fact that yours run to the 4th level and the other method only runs to the 3rd level because you have
Code:
{if $xxxx.subcategory_count gt 0}
So I don't believe that is the offset.

To give you an idea of how our category structure works:
13 Root Categories.
3 Levels Deep.
47 Subcategories (basically level 2 and level 3 combined).

Will you try both ways to see if you notice any difference? You should be able to just use it directly in menu.tpl.
__________________
4.1.8
Reply With Quote