Jump to content

PHP navlinks problem


simonbillinton

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";
}
};
}
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.