Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Parsing .html files for php code' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Parsing .html files for php code
Authored by: Beernd on May 30, '03 10:55:52AM

I use Server Side Includes for this. Put the following in your .html file:

<!--#config timefmt="%d/%m/%Y" -->
Last modified at <!--#echo var="LAST_MODIFIED" -->

The first bit defines the format for the date.
In httpd.conf I turned on server parsing for .html files with

AddType text/html .html
AddHandler server-parsed .html

Perhaps you should load the SSI module explicitly as well.

---
"Perhaps nothing is true, and not even that!"
Multatuli, Ideen 1

[ Reply to This | # ]

Parsing .html files for php code
Authored by: iambradn on Jun 02, '03 04:03:52PM

In order to save load on your server, you could rename your .html files to .php files, and nest your php code in there.

Then, the interpreter will still only need to process .php files, and not all of the .html files.

.php files don't need to have php code in them. You can take any .html and rename it .php, and it will display (as long as your webserver can handle php pages).



[ Reply to This | # ]
Parsing .html files for php code
Authored by: kahless on Jun 03, '03 03:39:20PM

I could have done that. However, I would have had to have changed all of the links in my pages that refered to the renamed files. Granted I only have a hundred page site, but I didn't want to check all the pages manually (not all .html references would need to be changed to .php).

For a small established site my suggestion seems to be fine. I haven't noticed any performance decrease.



[ Reply to This | # ]