Help me create a simple list from the menu.

For discussion and questions related to CMS Specific templates and stylesheets (CSS), and themes. or layout issues. This is not a place for generic "I don't know CSS issues"
Post Reply
R0BINH00D
Forum Members
Forum Members
Posts: 19
Joined: Wed Oct 24, 2007 4:32 pm

Help me create a simple list from the menu.

Post 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
R0BINH00D
Forum Members
Forum Members
Posts: 19
Joined: Wed Oct 24, 2007 4:32 pm

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

Post 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}
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am
Location: Arizona

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

Post 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}
R0BINH00D
Forum Members
Forum Members
Posts: 19
Joined: Wed Oct 24, 2007 4:32 pm

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

Post by R0BINH00D »

The class="nochild" should only be applied to top level nodes - is that possible?
R0BINH00D
Forum Members
Forum Members
Posts: 19
Joined: Wed Oct 24, 2007 4:32 pm

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

Post 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}
R0BINH00D
Forum Members
Forum Members
Posts: 19
Joined: Wed Oct 24, 2007 4:32 pm

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

Post 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?
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am
Location: Arizona

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

Post 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}
Post Reply

Return to “Layout and Design (CSS & HTML)”