I am a newbie to PHP. Here goes:
My website is published in the public_html directory on the online server and to the c:/xammp/htdocs on the localhost. In that directory are the website pages plus folders with files and page. (See tree below)
I have css and navigation files in the includes directory. The navigation files include a top, side and footer file. As the system is setup I can move to any of the files on the top level directory (public_html) Include files are called like this:
<?php include(”includes/nav_top.php”); ?>
any called page is resolved and all pages call call each other.
I want to store all the recipes in a sub directory <breakfast> that is a sub directory of <recipes> that is a sub directory of public_html.
To access htdocs/recipes/breakfast/eggs.php I had to make these changes:
<link rel="stylesheet" type="text/css" href="../includes/style.css">
<img src="../images/header.jpg" width="758" height="100"> (logo image)
<?php include(”../includes/nav_top.php”); ?> (header menu)
<?php include ('../includes/nav_l_side.php');?>
<?php include ('../includes/footer.php');?>
After these changes I can resole the recipe page.
Now the problem:
While on the public_html/recipes/breakfast/eggs.php page when I try to navigate back to index.php I get an object not found error. (error 404)
The link bar points to this address:
http://localhost/ej_00/recipes/index.php
While it needs to point here:
http://localhost/ej_00/index.php
It appears that the PHP interpretor adds the */recipes/ directory to the page.
By adding the full directory file\\C:\xammp\htdocs\index.php will work but when I publish it to the online server it wants to navigate back to the c: drive.
What I want is for the nav_side to return to index, recipe, breakfast and the top & footer navs to point to the index and index child pages.
What do I need to do to make it work?
This is my personal project. No pay involved just my time. This is my first PHP attempt.
Thanks for any suggestions or help
eddie
The directory tree looks like this:
<public_html directory Folder> 1st level
<image director folder> 2nd level Sub directory with the images
pic.jpg
pic.gif
<includes directory folder> 2nd level sub-directory with navigation files
nav_top.php
nav_side.php
nav_footer.php
<recipes directory Folder> 2nd level sub directory with major meal sub directory.
<breakfast directory Folder> 3rd level sub-sub directory with recipe pages
eggs.php
pancakes.php
another.php
<lunch directory Folder> 3rd level sub-sub directory with recipe pages
steak.php
fish.php
another.php
<drink directory Folder> 3rd level sub-sub directory with recipe pages
coffee.php
tea.php
another.php
<deserts directory Folder> 3rd level sub-sub directory with individual meal recipe pages
cake.php
pie.php
another.php
recipe.php
Index.php
Page_one.php
Page_two.php
Page_three.php