Jump to content

dreamweaver and php


Recommended Posts

Hello all,

 

It sounds stupid, but when I test the following php code using Dreamweaver (F12), it returns exactly the same code.  But if it is a htm file, F12 returns what I want.

 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=gb2312">

<title>無標題文件</title>

</head>

this is a php page

<?php this is a message enclosed in php tags ?>

<body>

 

</body>

</html>

 

And this is what I get using Dreamweaver F12

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=gb2312">

<title>無標題文件</title>

</head>

this is a php page

<?php this is a message enclosed in php tags ?>

<body>

 

</body>

</html>

 

Is there some setting I missed in PHP or in Dreamweaver??

 

Please help!

 

 

 

Link to comment
Share on other sites

When you use F12 in dreamweaver, it just opens the file as is. But PHP files need to pass through a server that parses the php code. If you want to test a php file locally, you need to set up a server on your computer, then set up dreamweaver to open the file through that server.

 

HTM files dont need to be parsed by a server, which is why you don't have this problem with them.

Link to comment
Share on other sites

When you install a server onto your computer, a folder will be designated as the base folder for files. Maybe its my documents/root_folder/ or something like that. You save your files in root_folder, then you open them using the address: localhost/filename.php

 

Make sure that your server is running when you do this.

Link to comment
Share on other sites

I used to have a site set up and it works fine without such server as mentioned. But after I re-installed Apache, PHP, and MySql again, I got this problem.  I suspected that there may be something that I should do either in Apache or PHP but haven't but I do not know where and what.

 

 

Apache is the Server. WAMP, Installs PHP, APACHE, MYSQL. All in one installer it is Just easier. And there root Folder is 'www'

Link to comment
Share on other sites

No. DW 2004 can handle PHP just fine (regardless of PHP version). Have you setup a site definition in DW? You must tell DW a server is available for parsing .php files otherwise you'll get the output you are getting.

 

To setup a site definition in DW to go to Site > New or Site > Manage Sites to manage an existing site definition, click the Advanced tab for configuration. Here is a Tutorial for setting up a Site definition in MX 2004

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.