need to add a nested submist to menu
Posted: Tue Aug 01, 2006 8:40 am
Pimptastic | Please use
the menu is created dynamically with this function/:
and the the subnav is an include is put together like this:
what I need to adjust is to have something output like this:
so I need a to produce a <ul> and </ul> for one of the menu items. How would I proceed in doing this by adjusting the PHP code above?
Pimptastic | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
I have a menu which contains the following XHTML code:Code: Select all
<ul id="subnav">
<li><a href="/press/releases.php">Executive Corner</a></li>
<li><a href="#">Market Numbers</a></li>
<li class="selected"><a href="#">White Papers</a></li>
<li><a href="#">Glossary</a></li>
<li><a href="#">Newsletter</a></li>
<li><a href="#">June 2006</a></li>
<li><a href="#">Case Studies</a></li>
</ul>Code: Select all
// CREATE SECTION SUBNAV imginfo = array("link"=>"","path"=>"","width"=>"","height"=>"","border"=>"","alt"=>"","css"=>"");
function subNav($link,$text,$subNavListInc=false,$imginfo=false){
if(isset($_SERVER['REQUEST_URI'])){
$tmp_class = ( ($link == $_SERVER['REQUEST_URI']) || (($link == $_SERVER['SCRIPT_NAME'])) ) ? ' class="selected"' : '';
}else{
$tmp_class = ($link == $_SERVER['SCRIPT_NAME']) ? ' class="selected"' : '';
}
$return_str = '<li'.$tmp_class.'><a href="'.$link.'">'.$text.'</a>';
if($subNavListInc){
$return_str .= "\r\n".$subNavListInc;
}
if(is_array($imginfo)){
if($imginfo["link"]){$return_str .= '<a href="'.$imginfo["link"].'">';}
$return_str .= '<img src="'.$imginfo["path"].'" width="'.$imginfo["width"].'" height="'.$imginfo["height"].'" border="'.$imginfo["border"].'" alt="'.$imginfo["alt"].'" style="'.$imginfo["css"].'" />';
if($imginfo["link"]){$return_str .= '</a>';}
}
$return_str .= '</li>'."\r\n";
return $return_str;
}Code: Select all
<ul id="subnav">
<?php
echo subnav('/insight/executive.php','Executive Corner');
echo subnav('/insight/stats.php','Market Numbers');
echo subnav('/insight/white.php','White Papers');
echo subnav('/insight/glossary.php','Glossary');
echo subnav('/insight/newsletter.php','Newsletter');
echo subnav('/insight/archive/2006_06.php','June 2006');
echo subnav('/insight/case_studies/palm.php','Case Studies');
?>
</ul>Code: Select all
<ul id="subnav">
<li><a href="/press/releases.php">Executive Corner</a></li>
<li><a href="#">Market Numbers</a></li>
<li class="selected"><a href="#">White Papers</a></li>
<li><a href="#">Glossary</a></li>
<li><a href="#">Newsletter</a>
<ul>
<li><a href="#">June 2006</a></li>
</ul>
</li>
<li><a href="#">Case Studies</a></li>
</ul>so I need a to produce a <ul> and </ul> for one of the menu items. How would I proceed in doing this by adjusting the PHP code above?
Pimptastic | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]