Forum Moderators: coopster
In my PHP pages, I have
<?php require('../functions/a_lite.php');?>
<?php require('../allphp.php');?>
<link href="/test.css" rel="stylesheet" type="text/css">
This code is in a page that resides in www.mysite.com/directory
If I make a page in www.mysite.com/directory/subdirectory, I have to change this to
<?php require('../../functions/a_lite.php');?>
<?php require('../../allphp.php');?>
<link href="/test.css" rel="stylesheet" type="text/css">
How do I do this without having to keep adding "../" in the require statement?
I tried "/functions/a_lite.php" as the require statement, but it doesn't work.
I want to avoid having the "../../../../" all over the place when I go deeper into directories!
Thanks!
So i put this at the top of each page where I need to "include" my scripts.
ini_set('include_path',
realpath($_SERVER['DOCUMENT_ROOT'] . '/../includes/')
. PATH_SEPARATOR
. ini_get('include_path'));
I can change "/../includes/" to "/../functions/" in my case since I put my php inside /functions/ ?
Thanks