views:

198

answers:

6

I have a few pages out (not too many though) and I was just thinking that I might want to change all of the pages to php instead of html. I am planning on using php in the future, I am just not quite ready yet to make it my full-time language. I know anythign you can do with html pages, you can do with php pages, but I just wanted to know, is there any reasons to stay with html compared to switching to PHP before my site gets too big and I wind up having to change 100 pages, and renaming hundreds of links?

+2  A: 

Your pages will still be HTML. PHP allows websites to be generated dynamically, that is, you can display a username for users. However, what is sent to the browser is still HTML.

I recommend that you start switching to PHP because even if you choose not to use PHP, your pages will still work and render fine. However, if you stick with .html and then decide to switch to PHP, then you'll have to convert every single link. So convert now, and save time.

One thing I should note: It is possible, but usually not done, to have .html pages render as PHP by modifying server settings. However, in most cases, the .php is used, as most servers are already configured to run .php though the PHP engine. But in case anyone with a large site has this question, this is an option.

waiwai933
agreed. You can have a .php file that contains just plain html but not the other way around.
Lukman
yes, renaming them now gives you the option to simply add PHP tags to it in the future.
littlegreen
A: 

The extension doesn't really matter. the PHP marker won't have any real effect until you begin embedding the tags into the files to engage the script processor.

Joel Etherton
+2  A: 

The only reason I can think of is a small hit in performance.

Most web servers like Apache, LightTPD are configured to serve .html files as static files while .php files will have to first go through the PHP engine to be interpreted and only then delivered to the client.

Alix Axel
In most [all?] cases, though, the time difference will be negligible, assuming we're talking about identical HTML files, only that one is run through the engine.
waiwai933
@waiwai933: I agree, still it's a disadvantage and that was the question. =)
Alix Axel
I know, just adding a note to your answer.
waiwai933
Yes, and this was a great answer! Thank you.
Sean Booth
@Sean Booth: You're welcome! =)
Alix Axel
A: 

Although it's true that you can do anything with PHP that you can do with HTML, the contrary is not true. With PHP you can do things that are not possible with HTML. Specifically, you can create dynamic pages with PHP, that is, pages whose contents are not fixed once you've written them.

If your pages are static, then you should continue to use HTML, if you need dynamic content, then you must use PHP (or another template/programming language).

Don
+1  A: 

You pretty much answered your own question. If you ever reach the stage where you want to add dynamic content to an HTML document, you're going to need to change the file extension, or alter the webserver configuration to have PHP process .html files.

Generally, you will want every page to contain, if not dynamic content, then at least consistent content. Things like headers and footers, that require a massive amount of copy-pasting in straight HTML or a single include() in php. PHP allows for much cleaner organization and much less repetition, even if you're not after dynamic content for your pages.

meagar
A: 

why stay with just html when u can have both? u can have static html pages for static content and php pages for dynamic content. You can manage not just links but almost everything with php. I am creating a site with just 30 pages and I can say, while I do have both php and html, some things get out of hand (links, templates, data, etc). Imagine having 70 more...

Ygam