Page 1 of 1

PHP... HTML... does it really matter?

Posted: Fri Jun 13, 2008 12:14 am
by louisgeorges
I tried to look around the forum to find my answer but I don't know where to begin or even what it's called.

I have to save all my file in .php because if I save them in .html they don't work once I load them to my server. I'm sure all my external files have to be in php to work with the php command (I'm guessing) but If I put my index and other main pages with the .html extension the site crash. all I have left is the text with no style (css) whatsoever.

In php everything works great, the only thing is I have to use .php in the address bar at the
end instead of .html.

example: http://www.mydomain.com/page2.php instead of .html

I'm using a couple of external files for my navigation menu and my footer... In case it matters too.

Here's my files:

in my index.php file

<html>
<body>
<div id="navbar">
<?php include("navbar.php"); ?>
</div>
</body>
</html>

In my navbar.php file

<h2>MENU</h2>
<ul>
<li><a href>HOME</a></li>
<li><a href>Contact Us</a></li>
</ul>

also here's my DOCTYPE and <head> in my index file just in case.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html lang="EN" dir="ltr" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/xml; charset=utf-8" />

<title>Untitled document</title>
<link rel = "stylesheet"
type = "text/css"
href = "stylesheet.css" />
</head>

I know that most people are used to see .html... I know when I'm surfing the net, I'm always putting .html at the end of the address and rarely .php, but does it really matter?

Thanks for your time,
Louis

Re: PHP... HTML... does it really matter?

Posted: Fri Jun 13, 2008 1:09 am
by Christopher
No it does not really matter. There is some processing overhead to PHP files, but that probably will make little difference to you. You can have a .php file that has all HTML inside if you want to. Generally people put static content in .html files.

Re: PHP... HTML... does it really matter?

Posted: Fri Jun 13, 2008 8:28 am
by louisgeorges
Thanks Arborint,

So the only difference in my site are the external parts "files" to create my page and down the road it wont make a difference or create any problems... right?

Re: PHP... HTML... does it really matter?

Posted: Fri Jun 13, 2008 9:37 am
by Christopher
If by "parts" files you mean your navbar.php, then it should not cause a problem down the road. Usually programmers put those files in a separate directory -- sometimes outside of the public directory.

Re: PHP... HTML... does it really matter?

Posted: Fri Jun 13, 2008 8:22 pm
by louisgeorges
Arborint,

Thanks for your help. I'm going to have a busy weekend, I have a lot php file to write. :D

I'll talk to you with the next problem!