Navigation include for all site directories


Posted on 16th Feb 2014 07:03 pm by admin

Hi,

I need a navigation include that can deal with directories at different levels on a site. All I can seem to find are the basic includes for files all in the same directory. This doesn't work for me because as soon as you navigate to a page in a nested directory the relative links don't work.

Is the only option for me to use absolute links? This would cause difficulty as I would need different addresses to achieve the same result on the testing server and remote site.

I also need to be able to identify the current page to style the link. At the moment I am using the code below which is fine whilst everything is in the same directory but introduce nested directories and some links will be reachable with just the $base. But only as long as current page and destination page are in the same directory.

Code: $base=basename($_SERVER['PHP_SELF']);
$menu=preg_replace("|<li><a href="".$base."">(.*)</a></li>|U", "<li class="current">$1</li>", $menu);
echo $menu;
I would greatly appreciate your help

270 Like 40 Dislike
Previous php-forum Next php-forum
Other php-forum

Mail Script Problems
I have created a PHP mail script. I am having a problem though. In $body i am trying to put two va

Storing/displaying image urls in a database?
Hi
Basically I have the following scenario:
User chooses picture from list. Picture info is ad

Displaying image pathname instead of image
Hello

Im trying to upload and then display images from a mysql database - Its only basic and

Multi image upload
I have a gallery to build and want to build a dynamic upload form to allow for $var number of fields

phpmailer class & pop.gmail.com?
Code: <?php
$mail->IsSMTP();
$mail->Host = "pop.gmail.com";

Thread in PHP
Thread in PHP
Some basic use and basic code for thread in php
This is my question?

Results from Db outputted twice
Hey guys.. for come reason my data is outputted twise shown in the image below and i cant figure out

Line break?
Hi, I'm new to the forum and new to php. I'm not sure if I'm using the correct terminology so here i

SWF image using php?
Hello once again.

My latest en devour requires me to produce an image of a static .swf that i

Help With editting and deleting form
Hallo !!

So look at this image :

http://img194.imageshack.us/img194/8272/snapshot5f.pn

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash