0

I was wondering how to display php on a html page? My site has a php backend doing all the work, html to make it look good. I'm trying to display a chat box which is coded in php on my html header page.

4
Contributors
5
Replies
6
Views
6 Years
Discussion Span
Last Post by kylegetson
0

I would recommend making the HTML file a PHP file and putting the php powered chat box where you need it, but if you insist on keeping it all HTML then I would make an iframe.

0

Or use URL Rewriting.

.htaccess

RewriteEngine On
RewriteRule (.*)\.html $1\.php [L]

This will make the browser think the document is .html but instead the server looks for .php.

PUBLIC URL: http://example.com/index.html
INTERNAL URL: DOCUMENT_ROOT/index.php

0

I would recommend making the HTML file a PHP file and putting the php powered chat box where you need it, but if you insist on keeping it all HTML then I would make an iframe.

I tried the IFRAME... Everything worked fine, until I started the chat. The user function works, but when I type something the admin doesn't see anything. I rather not rename the extension.

Or use URL Rewriting.

.htaccess
PHP Syntax (Toggle Plain Text)

1.
RewriteEngine On
2.
RewriteRule (.*)\.html $1\.php [L]

RewriteEngine On RewriteRule (.*)\.html $1\.php [L]

This will make the browser think the document is .html but instead the server looks for .php.

PUBLIC URL: http://example.com/index.html
INTERNAL URL: DOCUMENT_ROOT/index.php

Can I use this Rewrite Rule for just one page?

0

Yes this should be in a .htaccess file by the way.

RewriteEngine On
RewriteRule ^chatpage\.html chatpage\.php [L]

Will work on the document named chatpage.php and you can access it by the chatpage.html.

Just change the chatpage on both sides for whatever you document name is.

0

You could leave it as an html file, and make your html files parsable as php files (with addhandler in your .htaccess)

I would stay away form iframes wherever possible.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.