Page 1 of 1

Help me create a simple list from the menu.

Posted: Wed Oct 24, 2007 4:53 pm
by R0BINH00D
Please can someone help me create a simple ul list from the menu so I can use it with a www.opencube.com menu.

I need to create a menu template that produces the following html:


item1
item2
item3

item3a
item3b


item4
item5


Notice there's a class for parents, and a class for top level nodes with no children.


Here's the actual code i'm going trying produce:




Home
Services


Design


Website Design
Corporate Identity
Copywriting
Icons
Video
Banners
Flash
Fav Icons
Logos
New Item


Build


Web Applications
Database Integration
Content Management
LMS/VLE Development
ePortfolio Management
Print-on-Demand
Windows Applications
Online Shopping


Market
Manage
Consult
Train


Video
Other




News
About Us
Contact Details
 

Any help would really be appreciated.

Thanks

Dan

Re: Help me create a simple list from the menu.

Posted: Wed Oct 24, 2007 4:55 pm
by R0BINH00D
Heres what I have so far - it kinda works but it doesn't add the nochildren class and I'm not sure if its correct.


{if $count > 0}

{foreach from=$nodelist item=node}
{if $node->depth > $node->prevdepth}
{repeat string="" times=$node->depth-$node->prevdepth}
{elseif $node->depth prevdepth}
{repeat string="" times=$node->prevdepth-$node->depth}

{elseif $node->index > 0}
{/if}
{if $node->haschildren == true}
url}"{if $node->target ne ""} target="{$node->target}"{/if}> {$node->menutext}
{else}
url}"{if $node->target ne ""} target="{$node->target}"{/if}> {$node->menutext}
{/if}
{/foreach}
{repeat string="" times=$node->depth-1}

{/if}

Re: Help me create a simple list from the menu.

Posted: Wed Oct 24, 2007 5:11 pm
by Dr.CSS
Try...

{if $count > 0}

{foreach from=$nodelist item=node}
{if $node->depth > $node->prevdepth}
{repeat string="" times=$node->depth-$node->prevdepth}
{elseif $node->depth prevdepth}
{repeat string="" times=$node->prevdepth-$node->depth}

{elseif $node->index > 0}
{/if}
{if $node->haschildren == true}
url}"{if $node->target ne ""} target="{$node->target}"{/if}> {$node->menutext}
{else}
url}"{if $node->target ne ""} target="{$node->target}"{/if}> {$node->menutext}
{/if}
{/foreach}
{repeat string="" times=$node->depth-1}

{/if}

Re: Help me create a simple list from the menu.

Posted: Wed Oct 24, 2007 5:49 pm
by R0BINH00D
The class="nochild" should only be applied to top level nodes - is that possible?

Re: Help me create a simple list from the menu.

Posted: Wed Oct 24, 2007 6:45 pm
by R0BINH00D
I think this is it - can anyone improve on the syntax:



{if $count > 0}

{foreach from=$nodelist item=node}
{if $node->depth > $node->prevdepth}
{repeat string="" times=$node->depth-$node->prevdepth}
{elseif $node->depth prevdepth}
{repeat string="" times=$node->prevdepth-$node->depth}

{elseif $node->index > 0}
{/if}
{if $node->haschildren == true}
url}"{if $node->target ne ""} target="{$node->target}"{/if}> {$node->menutext}
{else}
{if $node->depth == 1}
url}"{if $node->target ne ""} target="{$node->target}"{/if}> {$node->menutext}
{else}
url}"{if $node->target ne ""} target="{$node->target}"{/if}> {$node->menutext}
{/if}
{/if}
{/foreach}
{repeat string="" times=$node->depth-1}

{/if}

Re: Help me create a simple list from the menu.

Posted: Wed Oct 24, 2007 6:58 pm
by R0BINH00D
Actually - this bit:

{repeat string="" times=$node->depth-$node->prevdepth}

makes the style appear for all new ul's when actually I only want it to appear for nodes > 2 - any ideas how to fix?

Re: Help me create a simple list from the menu.

Posted: Thu Oct 25, 2007 5:08 am
by Dr.CSS
If you need to target a specif spot in the menu template you can wrap it in numbers...

{if $count > 0}

{foreach from=$nodelist item=node}
{if $node->depth > $node->prevdepth}
{repeat string="" times=$node->depth-$node->prevdepth}
{elseif $node->depth prevdepth}
{repeat string="12" times=$node->prevdepth-$node->depth}

{elseif $node->index > 0}
{/if}
{if $node->haschildren == true}
url}"{if $node->target ne ""} target="{$node->target}"{/if}> {$node->menutext}
{else}
{if $node->depth == 1}
url}"{if $node->target ne ""} target="{$node->target}"{/if}> {$node->menutext}
{else}
url}"{if $node->target ne ""} target="{$node->target}"{/if}> {$node->menutext}
{/if}
{/if}
{/foreach}
{repeat string="45" times=$node->depth-1}

{/if}