After searching for an hour, I guess I'll post my direct question.
I am currently creating a website as a first time PHP'er. I understand most of it, but am still having problems with linking pages correctly with include();
Main site is index.php, which links to my header.php and other php pages. When I include one of the files, it will show everything just fine, however it will not link to anything OTHER than the page.
My CSS is in a diffrerent folder as well as my images, and they are all broken.
After doing some research, I realized that PHP has some realy fits with paths, since it's server side, and doesn't like linking to directories until you show it exactly where to go. Here's an exerpt of my site code, trimmed down, to show you what I'm doing.
Thanks if you can help.
include('header.php');
//The pages you wish to display
$pages = array(
'seeds' => 'seeds.php',
'contact'=> 'contact.php',
'forum'=> 'forum.php',
'support' => 'support.php'
);
//if the file exist, and is in the array it will display the file.
if(array_key_exists($GET['id'], $pages))
{
foreach($pages as $id => $name) {
if($GET['id'] == $id && file_exists($name)) {
include ($name);
}
}
}
else {
//We will now display the home page, but if some enters in the wrong name it will also display this page.
include("home.php");
}
This file is on webroot. CSS is in /css and images are in/images.
The files included are php files with no php in them, and are straight html. The included files all link to seperate directoies mentioned above.
Here's the site: http://www.seedhost.net