Pathways & References
Posted: Tue May 25, 2010 1:54 pm
Hello! I hope Tuesday is treating everybody right.
I thought this post was more of a "theory and design" issue than a code one, but forgive me if I'm wrong. I'm also aware this is not a new issue, and has been discussed on an endless number of forums and sites. As a php brand newbie, none of the info I've seen completely light the bulb for me, so to speak. I've been redoing a rather large and as of yet unpublished web I created several years ago in straight html and have crash landed into the world of php. Though I intend to take a thorough approach to learning all the ins and outs, I need to have this website (with its 140+ pages) ready to go within a few days....and I've already lost a few on trial and error.
On my computer, I am working with an Apache server which is set up as C://server/Apache/www/myserver.dev/public_html. As per the Apache httpd, the document root is htdocs (C://server/Apache/). All the files I'm designing within this server will need to be uploaded to another server once completed. "AddType application/x-httpd-php .html" is set up both *within the Apache httpd config* and *within a separate .htaccess file* file (the latter for the purposes of uploading to the other server).
Within public_html are my index.html and style.css files, as well as the following folders:
includes (which has header.php, footer.php, get_meta.php, introline.php, and sidebar.php)
counties (120 .html files, all of which use each of the above noted includes)
interests (10+ .html files, all of which use each of the above noted includes)
images (5+ image files)
The header, footer, and sidebar php files reference files in the images folder.
When all the .html and .php files are together in one folder, everything works fine. However, once separated into folders, I'm lost. I've tried various different manners of reference, including the format of
<?php include $_SERVER['document_root'] ."/includes/header.php"; ?>
But no luck. Each include returns these three errors:
Notice: Undefined index: document_root in C:\server\www\myserver.dev\public_html\counties\bath.html on line 30
Warning: include(/includes/header.php) [function.include]: failed to open stream: No such file or directory in C:\server\www\myserver.dev\public_html\counties\bath.html on line 30
Warning: include() [function.include]: Failed opening '/includes/header.php' for inclusion (include_path='.;C:\php5\pear') in C:\server\www\myserver.dev\public_html\counties\bath.html on line 30
I also tried moving my includes folder up to the same level as the public_html folder.
Can someone please babystep me through this? What do I need to do to make sure (1) my html's can properly and "dynamically" refer to includes in other directories, (2) my includes can refer to images in other directories, and (3) that all this will still work when I upload to another server.
Thanks so much in advance,
Brittanie
I thought this post was more of a "theory and design" issue than a code one, but forgive me if I'm wrong. I'm also aware this is not a new issue, and has been discussed on an endless number of forums and sites. As a php brand newbie, none of the info I've seen completely light the bulb for me, so to speak. I've been redoing a rather large and as of yet unpublished web I created several years ago in straight html and have crash landed into the world of php. Though I intend to take a thorough approach to learning all the ins and outs, I need to have this website (with its 140+ pages) ready to go within a few days....and I've already lost a few on trial and error.
On my computer, I am working with an Apache server which is set up as C://server/Apache/www/myserver.dev/public_html. As per the Apache httpd, the document root is htdocs (C://server/Apache/). All the files I'm designing within this server will need to be uploaded to another server once completed. "AddType application/x-httpd-php .html" is set up both *within the Apache httpd config* and *within a separate .htaccess file* file (the latter for the purposes of uploading to the other server).
Within public_html are my index.html and style.css files, as well as the following folders:
includes (which has header.php, footer.php, get_meta.php, introline.php, and sidebar.php)
counties (120 .html files, all of which use each of the above noted includes)
interests (10+ .html files, all of which use each of the above noted includes)
images (5+ image files)
The header, footer, and sidebar php files reference files in the images folder.
When all the .html and .php files are together in one folder, everything works fine. However, once separated into folders, I'm lost. I've tried various different manners of reference, including the format of
<?php include $_SERVER['document_root'] ."/includes/header.php"; ?>
But no luck. Each include returns these three errors:
Notice: Undefined index: document_root in C:\server\www\myserver.dev\public_html\counties\bath.html on line 30
Warning: include(/includes/header.php) [function.include]: failed to open stream: No such file or directory in C:\server\www\myserver.dev\public_html\counties\bath.html on line 30
Warning: include() [function.include]: Failed opening '/includes/header.php' for inclusion (include_path='.;C:\php5\pear') in C:\server\www\myserver.dev\public_html\counties\bath.html on line 30
I also tried moving my includes folder up to the same level as the public_html folder.
Can someone please babystep me through this? What do I need to do to make sure (1) my html's can properly and "dynamically" refer to includes in other directories, (2) my includes can refer to images in other directories, and (3) that all this will still work when I upload to another server.
Thanks so much in advance,
Brittanie