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

Need help installing PHP, configuring a script, or configuring a server? Then come on in and post your questions! We'll try to help the best we can!

Moderator: General Moderators

Post Reply
louisgeorges
Forum Newbie
Posts: 3
Joined: Thu Jun 12, 2008 11:52 pm

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

Post 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
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

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

Post 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.
(#10850)
louisgeorges
Forum Newbie
Posts: 3
Joined: Thu Jun 12, 2008 11:52 pm

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

Post 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?
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

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

Post 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.
(#10850)
louisgeorges
Forum Newbie
Posts: 3
Joined: Thu Jun 12, 2008 11:52 pm

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

Post 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!
Post Reply