Forum Moderators: coopster
<?php
// Get Main Navigation
include("includes/topnav.php");
?>
Now when you move down a level :
test.com/down-a-level/
you need to have the following:
include("../includes/topnav.php");
which essentially means two templates, now if I have a third level I have to create another template.
How do you deal with such issues. I dont have the need for a fully dynamic site, I just need to get to grips with the best way of doing this before I start proper so I dont give meyself greif and woe. This is even more pertinent when working on a dev site that has a whole different folder structure. I dont want to have to go through and change all the folder paths all the time.
Cheers
<?
## ini.php
ini_set('include_path', '/var/www/includes/');
?>
Then you only ever need do:
require('topnav.ihtml');
best practice [smarty.php.net] ;-)
Added: The nice thing about ini.php is that you can just adjust that one file when you move from your home machine to live server or vice versa
Nick
<?PHP
include "$DOCUMENT_ROOT/includes/topnav.php";
?>
where $DOCUMENT_ROOT is supplied automatically by the server. AFAIK this works on all *ix platforms where "register_globals" and "track_vars" are set to "on".