Jump to content

Archived

This topic is now archived and is closed to further replies.

simonbillinton

PHP navlinks problem

Recommended Posts

Hello all,

I'm wondering if someone can help with a small issue i have.

On this page - www.syrinx.net.au - we have a menu on the right - sustainable, development, etc.

The way the original designer coded it was that the name you see on the menu has to be the name of the link file. However i need to call the first item on the menu 'sustainable:' - with the colon - and i can't name a file that. How can i change the code to allow me to link to any file i wish?

I have included some of the 'functions.inc' file which covers the php code.

thanks for any help you can give.

Simon.

>>>>>>>>>>>>>>>>>>>>>>>

function make_navLinks($projectName) {
global $root_dir;
$facets = array("<strong>sustainable: </strong>","development","water treatment","restoration+remediation","ecological assessments","landscapes+builtscapes","universals");
echo '
<div id="contentRight">
<ul id="navLinks">
<li><a href="'.$root_dir.'/company-about.php" title="the company">the company</a>
<ul>
<li><a href="'.$root_dir.'/company-about.php" title="what we do, our expertise">about us</a></li>
<li><a href="'.$root_dir.'/company-structure.php" title="company structure">order of things</a></li>
<li><a href="'.$root_dir.'/company-resources.php" title="IT, material + reference">resources</a></li>
<li><a href="'.$root_dir.'/company-positions.php" title="positions vacant">positions vacant</a></li>
</ul>


<li><a href="'.$root_dir.'/contact.php" title="contact information">contact us</a>
</li>
</ul>
<h2>what we do</h2>

';
if($projectName!=='main') {
$file_array = getdirArray('./');
foreach ($file_array as $file_name) {
if (strstr($file_name, $projectName."-")) {
$facetsArray[]=substr($file_name, strlen($projectName."-"),-4);
} else {$facetsArray[]=Null;}
}
for ($i=0; $i<sizeof($facets); $i++) {
if(in_array($facets[$i],$facetsArray)) {
if($facets[$i]==substr(basename ($_SERVER['PHP_SELF'],".php"), strlen($projectName."-"))) {
echo '<li class="here"><a href="'.$root_dir.'/projects/'.$projectName.'-'.$facets[$i].'.php">'.$facets[$i].'</a></li>'."\n";
} else {
echo '<li><a href="'.$root_dir.'/projects/'.$projectName.'-'.$facets[$i].'.php">'.$facets[$i].'</a></li>'."\n";
}
} else {
echo '<li class="no"><span>'.$facets[$i].'</span></li>'."\n";
}
};
} else {
for ($i=0; $i<sizeof($facets); $i++) {
if($facets[$i]==substr(basename ($_SERVER['PHP_SELF'],".php"), strlen($projectName."-"))) {
echo '<li class="here"><a href="'.$root_dir.'/projects/'.$projectName.'-'.$facets[$i].'.php">'.$facets[$i].'</a></li>'."\n";
} else if ($facets[$i]=="remediation" or $facets[$i]=="research" or $facets[$i]=="masterplanning" or $facets[$i]=="landscape" or $facets[$i]=="ecotourism") {
echo '<li class="no"><span>'.$facets[$i].'</span></li>'."\n";
} else {
echo '<li><a href="'.$root_dir.'/projects/'.$projectName.'-'.$facets[$i].'.php">'.$facets[$i].'</a></li>'."\n";
}
};
}

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.