For Programmers: Free Programming Magazines  


Home > Archive > PHP Smarty Templates > August 2005 > one for the gurus Please Help









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author one for the gurus Please Help
Gregory Machin

2005-08-07, 5:02 pm

Hi=20
please help.

I'm trying to create a foldout menu that can go infinatly deep.
It has some java and css.
but what i cant get rite is to generate the correct html out put..
this is an example of what i'm trying to get ..
<ul id=3D"nav">=20
<li><a href=3D"#">Home</a></li>=20
<li><a href=3D"#">About</a>=20
<ul>=20
<li><a href=3D"#">History</a></li>=20
<li><a href=3D"#">Team</a></li>
<li><a href=3D"#">Offices</a></li>=20
</ul>=20
</li>=20
<li><a href=3D"#">Services</a>=20
<ul>=20
<li><a href=3D"#">Web Design</a></li>=20
<li><a href=3D"#">Internet=20
Marketing</a></li>=20
<li><a href=3D"#">Hosting</a></li>=20
<li><a href=3D"#">Domain Names</a></li>=20
<li><a href=3D"#">Broadband</a></li>=20
</ul>=20
</li>
</ul>

the problem is the parent child relation and geting the correct tags
in the correct place ..
this is what i'm working from but i can't get the logic to work :-/

<ul id=3D"nav">
{foreach from=3D$sections item=3Dsection}
{assign var=3DcommonParent value=3D1}
{foreach from=3D$current->parents item=3DparentId}
=09{if $parentId =3D=3D $section->id || $parentId =3D=3D $section->parent}
=09<ul>=09
=09{assign var=3DcommonParent value=3D1}
=09{/if}
{/foreach}

{if $section->numParents =3D=3D 0 || $commonParent || $section->id =3D=3D
$current->id || $section->parent =3D=3D $current->id}


<li><a href=3D"{$section->link}" class=3D"navlink"{if $section->new_window}=
=20
=09=09=09=09=09=09=09=09target=3D"_blank"{/if}>{$section->name}</a>

</li></ul>
{/if}
{/foreach}
</ul>

many thanks

--=20
Gregory Machin
greg@linuxpro.co.za
gregory.machin@gmail.com
www.linuxpro.co.za
Web Hosting Solutions
Scalable Linux Solutions=20
www.iberry.info (support and admin)
www.goeducation (support and admin)
+27 72 524 8096
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com