How do I make my website pages location independent?
Posted: Tue Aug 16, 2011 11:37 am
Hi there,
First off, i'm total newby at php. I know basic functions such as <?php include and thats about it really!!!
My pages are set up the following way...
1. I have a /common folder which has the header.php and footer.php and any other 'common' pages I need.
2. I then have my index.php file which calls the header and the footer.php from the /common folder.
3. I've also created a new folder (/newfolder) which has a file in /newfile.php so from the root its - newfolder/newfile.php
4. I also have an images folder which the files are linked to from each page I create.
My problem is that this changes from page to page as they are in different directories and different levels.
Is there a best way to do this so I don't have to use ../folder/file.php? I've tried /folder/file.php but I get the following error - Warning: include(/common/header.php) [function.include]: failed to open stream: No such file or directory in /homepages/27/d194522123/htdocs/webfeetdesign/testing/lwk-tests/white-layout/landing.php on line 12
To see the mess i've created go to http://xxxxxxxxxxx.com
Hope someone out there can understand my gibberish!!!
Many thanks
Alex
First off, i'm total newby at php. I know basic functions such as <?php include and thats about it really!!!
My pages are set up the following way...
1. I have a /common folder which has the header.php and footer.php and any other 'common' pages I need.
2. I then have my index.php file which calls the header and the footer.php from the /common folder.
3. I've also created a new folder (/newfolder) which has a file in /newfile.php so from the root its - newfolder/newfile.php
4. I also have an images folder which the files are linked to from each page I create.
My problem is that this changes from page to page as they are in different directories and different levels.
Is there a best way to do this so I don't have to use ../folder/file.php? I've tried /folder/file.php but I get the following error - Warning: include(/common/header.php) [function.include]: failed to open stream: No such file or directory in /homepages/27/d194522123/htdocs/webfeetdesign/testing/lwk-tests/white-layout/landing.php on line 12
To see the mess i've created go to http://xxxxxxxxxxx.com
Hope someone out there can understand my gibberish!!!
Many thanks
Alex