Please Help- PHP Shown on HTML page

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
hostresponse
Forum Newbie
Posts: 1
Joined: Fri Jul 29, 2005 10:57 pm

Please Help- PHP Shown on HTML page

Post by hostresponse »

Greetings,

I was hoping a fellow forum member could help me out.

I came across a forum post (forgot to bookmark)showing a piece of code that could be inserted into my htaccess file, which would allow a php include tag(s) to be displayed on a file saved as .html.

Ex:

<?php
include ("filename.php");

?>

Thanks in advance,

Hostresponse
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

Post by s.dot »

you could always use htmlentities

Code: Select all

$string = htmlentities("<? this is php");
echo $string;
or, when writing your html, convert the special characters yourself

Code: Select all

&amp;amp;lt;? this is php ?&amp;amp;gt;
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

I think he's referring to running .html files as PHP

Code: Select all

AddType application/x-php .php .html
I believe.. refer to the "install.txt" file that comes with a php download for specifics.
Post Reply