Wednesday 06 July 2005 10:20:13 am
Hi there, If someone could help out on this bit of coding, I can give a good dropdown suckerfish style menu in the contribs.
The end result I'm after can be seen via: http://www.htmldog.com/articles/suckerfish/dropdowns/example/ I'm writing the code that creates the bullet list that then becomes the dropdown navigation menu. The code needs to spider the folders, very much like the site map - but has to go beyond just two levels. Using the sitemap code I have:
{let page_limit=10
col_count=2
children=fetch('content','list',hash(parent_node_id,2,limit,$page_limit,offset,$view_parameters.offset))
child_count=fetch('content','list_count',hash(parent_node_id,$node.node_id))}
<ul id="nav">
{section name=Child loop=$children}
<li><a href={$Child:item.url_alias|ezurl} class="daddy">{$Child:item.name}</a></li>
{let sub_children=fetch('content','list',hash(parent_node_id,$Child:item.node_id,limit,$page_limit))
sub_child_count=fetch('content','list_count',hash(parent_node_id,$Child:item.node_id))}
<ul>
{section name=SubChild loop=$:sub_children}
<li><a href={$:item.url_alias|ezurl}>{$:item.name}</a></li>
{/section}
</ul>
{/let}
{/section}
</ul>
{/let}
The problem is - like I say, only 2 levels - needs to work for three or four. The second big issue is that the code created for the dropdown needs to be in format:
<li><a href="#">Percoidei</a>
<ul>
<li><a href="#" class="daddy">Remoras</a>
<ul>
<li><a href="#" class="daddy">Echeneis</a>
<ul>
<li><a href="#">Sharksucker</a></li>
<li><a href="#">Whitefin Sharksucker</a></li>
</ul>
</li>
<li><a href="#" class="daddy">Rhombochirus</a>
<ul>
<li><a href="#">R. osteochir</a></li>
</ul>
</li>
</ul>
</li>
<li><a href="#" class="daddy">Tilefishes</a>
<ul>
<li><a href="#">Caulolatilus</a></li>
<li><a href="#">Lopholatilus</a></li>
<li><a href="#">Malacanthus</a></li>
</ul>
</li>
</ul>
</li>
The important bit here is that there needs to be some switch code within the <li> tag that says 'if this node has children, print 'class="daddy"'. Could anyone show me the code for this? Much appreciated. Steve.
http://www.oneworldmarket.co.uk
|