Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

DW CS5 - PHP in HTML file - no display in DW live view

New Here ,
Jul 05, 2010 Jul 05, 2010

Have DW CS5, Local IIS 7 (Win 7 64x) testing server (Server Model: PHP MySQL) set up and working. External browsers render .html files with PHP fine (URL=http://localhost/testphp.html), DW Live View will not parse/display the PHP with ".html" extension. No ".htaccess" file, DW PHP Tag Library has all PHP "Used In:" boxes checked. Example:

Example 1

File name: testphp.php

<html>

<body>

<h1>Hello There</h1>

<script language="php">

echo "Hello World";

</script>

</body>

</html>

DW Live View and external browser URL: http://localhost/testphp.php:

Hello There

Hello World

Example 2

File name: testphp.html (same content as above, just filename extension changed)

<html>

<body>

<h1>Hello There</h1>

<script language="php">

echo "Hello World";

</script>

</body>

</html>

DW Live View:

Hello There

external browser URL: http://localhost/testphp.html:

Hello There

Hello World

_______________________________________________________

How to configure DW CS5 to display PHP in DW Live View with file extension= ".html"?

Thanks in advance, have spent 2 days trying to accomplish!

Steve

TOPICS
Server side applications
2.3K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 05, 2010 Jul 05, 2010
File name: testphp.php

<html>

<body>

<h1>Hello There</h1>

<script language="php">

echo "Hello World";

</script>

</body>

</html>

This is not PHP code

The red code part should read as to be classified as PHP script

<?php echo "Hello World"; ?>
File name: testphp.html (same content as above, just filename extension changed)

<html>

<body>

<h1>Hello There</h1>

<script language="php">

echo "Hello World";

</script>

</body>

</html>

Apart from the same mistake as above, this file will not be recognised as containing PHP without the PHP extension. You can setup the server to accept HTML and to interpret same as PHP, but I would not recommend this.

DW Live View:

Hello There

external browser URL: http://localhost/testphp.html:

Hello There

This is amazing! With the code above? If you hadn't told me I would not have believed it. I tried it on my humble setup and you are correct. It works using the PHP file but not the HTML file. It doesn't matter, it is still not correct.

How to configure DW CS5 to display PHP in DW Live View with file extension= ".html"?

It is not up to DW to determine, it is the PHP server that determines whether PHP in an HTML file will be shown. Have a look here http://php.about.com/od/advancedphp/p/html_php.htm .Once again, I do not recommend this

I hope this helps.

Ben

Wappler is the DMXzone-made Dreamweaver replacement and includes the best of their powerful extensions, as well as much more!
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jul 05, 2010 Jul 05, 2010

Thank you, Ben, for your thoughtful response.

I have checked the PHP manual for syntax and the:

<script language="php">

echo "Hello World";

</script>

is perfectly "AOK".

I did, however, change it to your suggestion:

<?php echo "Hello World"; ?>

with exactly the same result. I then followed your suggested link and created an ".htaccess" file in the server root with the line:

AddType application/x-httpd-php .html

I restarted the server machine and the IIS server, back into DW and still have the exact same result - external browsers (FF, Chrome, IE8, and Safari) all render the PHP in the .html file just fine, but DW's Live view will not.

This does seem to be an issue with DW's built-in Live View browser and not with the IIS 7 server or my PHP installation/php.ini file. I have copied the testphp.html file to two other external web-servers supporting PHP and the PHP in the .html file (one with .htaccess and the other without) renders fine (with both the <script> tag and the <?php ... ?> tag.

Any further clues you may have would be appreciated.

Thank you,

Steve

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jul 06, 2010 Jul 06, 2010
LATEST

To anyone reading this thread who may have the same problem:

I've finally stumbled across the answer:  I just needed to check the View/Live View Options/Use Testing Server for Document Source.

Both the ".php" and ".html" file extensions now display the PHP rendering in DW Live View.

This thread now Answered successfully !

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines