Welcome to WebmasterWorld Guest from 18.104.22.168 , register , free tools , login , search , subscribe , help , library , announcements , recent posts , open posts Pubcon Platinum Sponsor
PHP on html page NeedScripts msg:1253740 11:14 pm on Jul 14, 2002 (gmt 0) Does anyone knows how to use php tags in .htm or .html page?
Lisa msg:1253741 11:22 pm on Jul 14, 2002 (gmt 0)
NeedScripts, Welcome to WMW. We hope you find what you are looking for and stick around.
PHP tags inside an HTML document are no different then PHP tags inside a PHP document. The real issue is what interpreter is parsing your HTML files. You need to make sure Apache uses the PHP parser on all files that have the .HTML extension.
lorax msg:1253742 12:14 am on Jul 15, 2002 (gmt 0)
Drop PHP in where you need it like so:
<p>Today's date is <?php echo date('F j, Y'); ?></p>
mavherick msg:1253743 12:43 am on Jul 15, 2002 (gmt 0)
if you're using Apache, you might want to add the following line to your httpd.conf file:
AddType application/x-httpd-php .html
AddType application/x-httpd-php3 .html
but this will make the php engine to parse all html files, so make sure that's what you want.
SmallTime msg:1253744 12:48 am on Jul 15, 2002 (gmt 0)
Optionally you could have parsing on for .htm, and not for .html, so your static pages would not be parsed, but the ones containing php would be. Name any pages with php .htm, etc NeedScripts msg:1253745 5:03 pm on Jul 15, 2002 (gmt 0)
Thanks for all the help. I am going to try it out, hope this stuff works ;)