Is there an easy way to to this ? I want to write a general template that will include one of these parts depending on the file that is called if file1.php include <?php chdir("../includes"); include 'include1.inc'; ?> PHP: if file2.php include <?php chdir("../includes"); include 'include2.inc'; ?> PHP: any hints on what I should look in to ? Thanks for your help ! p
$_SERVER['REQUEST_URI'] will give you /file1.php, etc, as a string. you can manipulate it from there to do what you want.
hmmm.... maybe I need more info incase file1 and file2 are not in the same directory. agh! EDIT : it seems it will give a list of the directories and path aswell. Thanks !
how can I make sure that a request for http://www.mysite.com/test/ http://www.mysite.com/test/index.php $request_uri = $_SERVER["REQUEST_URI"]; PHP: that $request_uri will have the same value ? EDIT :I guess $_SERVER['PHP_SELF']; is better as it gives what I need.
Use ModRewrite to convert the folder path to a querystring variable, then use your $_GET['var'] to define which include to use