43

cafefrenzy.com

PHP Includes Bug in Dreamweaver CS3

I have a love hate relationship with WYSIWYG editors. Historically they’re great for “quick and dirty” sites but crash and burn with all their bloated add-ons when you need to do any back end programming. However, I must say, Adobe Dreamweaver CS3 is a huge improvement over Dreamweaver 8 but there are still some problems with it interpreting PHP.

The Problem
I opened an existing website I created with PHP/mySQL and CSS in Dreamweaver CS3 and immediately noticed Dreamweaver didn’t interpret the include(); function correctly. Dreamweaver neglected to include my header.php file which contains my CSS link (amoung other crucial elements) thus, the entire site lacked my formatting in the design view. I thought, “that’s odd considering Dreamweaver has a PHP code insertion tab with the include() function”. Then I noticed my footer.php file was showing up in Dreamweaver. Now I am getting angry.

It turns out, Dreamweaver does not correctly interpret the include function if there is any other code in the PHP script.

For example, Dreamweaver would be baffled by the following simple script:

< ?php
$title = "Home page";
include("includes/header.php");
?>

Dreamweaver would not include the header.php file in the above senario. However, if you breakup the code into two scripts:

< ?php
$title = "Home page";
?>


< ?php
include("includes/header.php);
?>

Dreamweaver will correctly interpret the PHP script and include your header.php file. What a headache.

< --UPDATE-->
I should note that the problem for me is not so much viewing the webpage correctly in the Dreamweaver preview pane (I use a test server for that), it’s more that I want to have the nifty auto suggest feature work for my attached CSS styles. The CSS stylesheet link is in my header.php file so unless I chunk my code like the above example, Dreamweaver doesn’t see that I have an attached CSS stylesheet.

4 Responses

You can follow the comments for this article with the RSS 2.0 feed.

That… is ridiculous. Well, at least now we know. Thanks!

1 Adrian August 16, 2007 4:30 pm

I hand-code everything….you crazy kids with your fancy shmancy toys!

That is kind of cool though Ryan…I didn’t think there would be a web development tool that would actually include a file in development mode.

2 Mike Olbinski August 16, 2007 9:56 pm

It may be more involved than that. I have little experience with php, and am just getting up to speed with Dreamweaver (after using GoLive for a few years).
There’s a site I am building at the moment which has a Spry menu bar in one file loaded into the other pages with a call.
If I place a DW php include ‘object’ in the page, the site breaks as it can’t find the required directory (??!). However, if I cut & paste the same code I used in GoLive, the site functions perfectly BUT DW’s page display goes completely FUBAR: all you can see is the menu text - all other content disappears.

Still trying to find out why.

3 Grant Gittus January 31, 2008 3:46 am

I never use dreamweaver for the design view, it takes just as much time to upload the file to my site and look at it there. I guess if you don’t have a domain you can test things on this is a problem but really I could care less if the design view doesn’t work perfectly with php. I like dreamweaver for its code view where it auto completes redundant html tags and color codes different tags/functions making it very clean and easy to read.

4 Jazz February 28, 2008 11:48 am

Leave a Reply

Required fields are marked with an asterisk (*), you may use these tags in your comment: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Most Recent Post

Yay! Free Paintings!

Can I just say, I have the best mother-in-law a guy could ask for. A few weeks ago my mother-in-law sent my wife and I three abstract paintings that she made just for us. Take a look at the gallery below. We love them! (Check out the photos after the break)

Categories

Content © cafefrenzy.com
Proudly powered by WordPress
Theme designed by The Design Canopy

Entries (RSS)
Comments (RSS)

22 queries.
0.333 seconds.