PHP code not interpreted
Posted 12 March 2006 - 09:18 PM
I am trying to display a report (set of returned data from a mysql backend). The site was made with Dreamweaver templates and other PHP code works but that is code that is called by the form. For this report I have php code in line since all it will do is display a report. It is witin the editable region of the HTML file.
Once I run the page and view source below is the excerpt I see in the view source window. Nothing displays on the form other than an empty table.
Obviously below I'm just tryint to get any php code interpreted. I've tested the SQL statement and the program outside the dreamweaver HTML file and it works.
Thanks in advance!
<td><!-- InstanceBeginEditable name="page_body" -->
<table width="200" border="1">
<td>[!--coloro:#CC66CC--][span style=\"color:#CC66CC\"][!--/coloro--]<?php echo "Hello World"; ?>[!--colorc--][/span][!--/colorc--]</td>
$chapterTitle = 'PHP Syntax';
$message = "The chapter you are currently reading is $chapterTitle";
<!-- InstanceEndEditable -->
Posted 12 March 2006 - 11:11 PM
Posted 13 March 2006 - 01:43 AM
Unless the code is an include file, Dreamweaver-generated, or extension-generated, Dreamweaver won't show it in any helpful way, just as a block of PHP code.
I've tried using both methods, that is basically all the code within the HTML file and an include file
<?php include (./includes/view_user.php) ?>
Neither method actually executes the code. It't almost like it a comment.
Posted 13 March 2006 - 02:23 AM
Posted 13 March 2006 - 02:28 AM
If you're looking to test PHP files offline, I think your best bet is to download and install apache.
I have both Apache and PHP installed and running. The PHP file on it's own works just fine. It's when I either include it into the Dreamweaver HTML file (based on a template) either directly or via an include file that it is not interpreted.
So the commands in a PHP file I call directly work, imbedded (or included via the include statement) within the HTLM file is not interpreted. When I view source I see basically either the code or the include statement. See example from my first posting.
Posted 13 March 2006 - 02:40 AM
Posted 13 March 2006 - 12:22 PM
Posted 13 March 2006 - 04:53 PM
For any PHP to run the file has to be saved as a .php file.
whilst this is obvious, it's actually spot on - and unless something drastically wrong is going with your setup or your file naming, i'd run with this answer. i very much doubt that dreamweaver has anything to do with it - once the file is in the browser, dreamweaver has nothing to do with it.
if you have PHP set up, and it works for PHP files, then my guess is the files youre embedding PHP into are HTM/HTML files or similar, in which case the server wont even bother parsing them as php.
i kinda reckon that it's good practice to always use the same extensions throughout the site, even if a file uses no php in it at all.
I say old chap, that is rather amusing!
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users