View Full Version : Php and Html
Shile
07-01-2004, 04:35 PM
Is there ANY way to implement php script on .html page?
Or must the page be .php too?
I have EXISTING .html pages.I need two php script on my site INTEGRATED in almost all pages.
Is there a way? or I have to make all my existing pages again in .php?
TNX
Whiteknight
07-01-2004, 11:33 PM
yes, there is a way, but it depends on several things
first, in an html page (.html or .htm) you must have a <?php ... ?> tag, with all your php in between the two question-mark-brackets. also, you must set your server to parse .html and .htm pages for php content, which is different for every server software.
I used to know how to do it in IIS and Apache, but i cant remember either now, because I currently dont have a working server to play with anymore. what software do you run, so we can pinpoint an answer?
iDxMan
07-03-2004, 01:44 PM
apache:
AddType application/x-httpd-php .html
AddType application/x-httpd-php .htm
Although this will slow down your pure-html pages. I'd suggest renaming your dynamic pages to .php - unless that's going to cause problems with existing links.
Mr. Popularity
05-04-2005, 03:41 AM
just rename your .htm* files to .php and leave it be... PHP will parse the HTML as HTML... add your PHP code in the proper php tags and that's it. :)
Delta_Boy
05-31-2005, 12:25 AM
If you must edit a bunch of pages, a good idea to make future editing easier is to use a sort of template. You create seperate files for your header and footer. Then for each page your create just attach the header and footer to your page content with the "require" function. For example, When when you wish to make a change to the header, all you do is edit the "header.php" Then your changes will be seen across all of your pages that use the "require" function.
an php embedded in html would look something like this:
<?php
require("header.php");
?>
Page content.
<?php
require("footer.php");
?>
You could use "header.htm" if it is static but most likely you would want dynamics such as a date in the header. The above is pure example.
Of course, www.php.net is always the best place for php reference.
vBulletin® v3.7.0, Copyright ©2000-2009, Jelsoft Enterprises Ltd.