I have my website (http://www.the-world.tk) all in PHP now and although I'm just starting to get the hang of it, I have quite a few features. I would like to install other things, but some need to be in subfolders and my navigation bar is included as include("nav.php"); and in a subdomain, the links would obviously point to the wrong pages. Is there a way around this and does it involve $PHP_SELF???
Navigation Code across subfolders
Im not sure what is the problem here, really.
Just include your file 'nav.php' like this ;
include '../nav.php';
That should do the trick.
Hope this helps
i can do that but obviously the links point to the wrong place!!!
Sorry, I just do not understand your point. Perhaps if you give me an exemple of your nav.php, I could undersand better
say i hav a link to the home page "index.php" in my nav.php which is included in all files
if the file was "images/gallery.php" or sumthin, the home link would point to "images/index.php" and the idea of includin it was to avoid the need to change each page or folder...
Yes, I see your point.
Avoid this by using full URL instead of just relative URL/file names.
Example, in your nav.php file
<?
define('BASE_URL', 'http://www.the-world.tk/');
?>
<A HREF="<?= BASE_URL . 'index.php';?>">Home page</A><BR>
<A HREF="<?= BASE_URL . 'section1/index.php';?>">Section 1</A><BR>
<A HREF="<?= BASE_URL . 'section2/index.php';?>">Section 2</A><BR>
Hope this helps.