File not found error

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
skyhigh007
Forum Newbie
Posts: 2
Joined: Mon Oct 01, 2007 11:15 am

File not found error

Post by skyhigh007 »

feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


Hi

I'm trying to test out my php pages that i have created for a template. Here's my situation:  Every page that I've created I copy the below code and put infos that I needed for a particular page between the <?php require('Template/header.php'); ?>  and 
<?php require('Template/footer.php'); ?>  After all the pages are created, when I click on one link and it shows the page info, however when I click on the next link, it gives me "Template/Template/Contact.php was not found on this server" Error. If I go back to index page and then click on the contact page, it will show the content. Anyone knows the reason why im getting this error ? or is it because i use require function too much ?

Here's my Index.php

Code: Select all

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<title>Testing Page</title>
<link href="Template/style.css" media="all" rel="stylesheet" type="text/css" />
</head>
<body>
<?php require('Template/header.php'); ?>
<?php require('Template/footer.php'); ?>
</body>
</html>
Heres my header.php, basically its a menu

Code: Select all

div id="page_menu">
	<ul id="menu">
		<li><a href="http://localhost/Cartweaver3PHP/index1.php">Home&nbsp;&nbsp;
			</a></li>
		<li><a href="Template/Bio.php">Bio&nbsp;&nbsp;
			</a></li>
		<li><a href="Template/Store.php">Our Store&nbsp;&nbsp;
			</a></li>
		<li><a href="Template/Gallery.php">Gallery&nbsp;&nbsp;
			</a></li>
		<li><a href="Template/Contact.php">Contact Us&nbsp;&nbsp;
			</a></li>
	</ul>
</div>

feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
User avatar
Zoxive
Forum Regular
Posts: 974
Joined: Fri Apr 01, 2005 4:37 pm
Location: Bay City, Michigan

Post by Zoxive »

Code: Select all

<a href="Template/Contact.php">
Basically what that Link is doing is adding Template/Contact.php on to the END of the current url.

So if you were in /home it would be /home/Template/Contact.php
If you were in /Template it would put you in /Template/Template/Contact.php and what do you know, thats your error!

You can either use Absolute Urls, or Relative.
Absolute = http://website.com/Template/Contact.php
Relative = /Template/Contact.php
Relative = ./Template/Contact.php
Relative = ../Template/Contact.php

Edit: Fixed google link
Last edited by Zoxive on Mon Oct 01, 2007 11:57 am, edited 2 times in total.
skyhigh007
Forum Newbie
Posts: 2
Joined: Mon Oct 01, 2007 11:15 am

Post by skyhigh007 »

How do you make it work if you use relative?
User avatar
Zoxive
Forum Regular
Posts: 974
Joined: Fri Apr 01, 2005 4:37 pm
Location: Bay City, Michigan

Post by Zoxive »

skyhigh007 wrote:How do you make it work if you use relative?
Depending on the base directory, you would use different Methods. A quick google search, gives you plenty of Information about Relative Urls.

http://www.google.com/search?q=Relative+Urls

http://www.webreference.com/html/tutorial2/3.html
http://www.webdevelopersnotes.com/desig ... _urls.php3
http://brainstormsandraves.com/archives ... lute_urls/

(We as a community are here to help/poke you in the right direction, not do everything for you)
Post Reply