0

I searched already all the day for a solution to execute PHP files in a HTML file.

I use a CMS based on PHP. This CMS uses a Design template System where the Design has to be in a index.htm File. When renaming this file to index.php - it don't run (tested).

I am designing a new Clanpage and want to insert a "serverviewer".

This one is in a PHP file and does this:

Link to picture

I used this to call the php file:

  <div style="width: 280px; height 90px; float: left;margin-right: 10px; margin-bottom: 15px;" >
    <?php include("http://www.this-is-war.com/tiw/include/designs/TiWlog/sv/sv_01.php"); ?>
  </div>

but unfortunately php-code in a HTML file is not parsed, and I get no Serverviewer.

What can I do to execute a PHP statement in a HTML file without renaming the file to a .php extension?

halfer
  • 18,701
  • 13
  • 79
  • 158
mic
  • 19
  • 3

2 Answers2

1

Add this line either to apache conf file or .htaccess file so php can execute html file

 AddType application/x-httpd-php .html
mustafa
  • 699
  • 3
  • 9
  • 24
  • In general, if a question is a duplicate, it's best just to cast a close vote rather than answering it again. If more detail is required on the 'canonical page' for this question, by all means do add it there. – halfer May 05 '13 at 16:17
  • its not a duplicate ... my second question here @stackoverflow. I tried AddType application/x-httpd-php .html - but without success .. the php is not displayed. I created a .htaccess file in the directory where the htm File is and put "AddType application/x-httpd-php .html" as only command in. Using the Ifram works .. but this is not a really good way to program .. why AddType brings no change on my webspace ? – mic May 05 '13 at 16:47
0

A easy solution for this is to use an iframe

<div style="width: 280px; height 90px; float: left;margin-right: 10px; margin-bottom: 15px;" >
<iframe src="http://www.this-is-war.com/tiw/include/designs/TiWlog/sv/sv_01.php"></iframe>
</div>
Om Choudhary
  • 405
  • 4
  • 17