PDA

View Full Version : PHP Include Support in DW?


rap911help1
07-17-2009, 05:07 AM
Not sure of right question to ask. Am looking to change structure of my website to use PHP includes.

Have DW 8 (education edition) and wonder if it's necessary / advisable to upgrade to DW 9 (CS3?/CS4?)?

Setup a test where doctype is in a 'general' include and main code is in another include. When try to go to 'DESIGN' display nothing is displayed. Disheartening

Want to continue using DW, so if I can't display in Design mode, probably will try restructuring w/o PHP files.

Corrosive
07-17-2009, 05:18 AM
Not sure of right question to ask. Am looking to change structure of my website to use PHP includes.

Have DW 8 (education edition) and wonder if it's necessary / advisable to upgrade to DW 9 (CS3?/CS4?)?

Setup a test where doctype is in a 'general' include and main code is in another include. When try to go to 'DESIGN' display nothing is displayed. Disheartening

Want to continue using DW, so if I can't display in Design mode, probably will try restructuring w/o PHP files.

Anything down to DW MX2004 has good enough support to use PHP includes. They should display in design view.

edbr
07-17-2009, 05:46 AM
you could also look at html includes if that is your only purpose for using php.

DWcourse
07-17-2009, 05:56 AM
I'm using a new version but this works for me AND displays in the design view:


Make sure your file name uses the .php extension
Select Server-Side Include from the Common Tab of the Insert palette.
Browse to the file you want to include and select it.That's it.

BTW, I believe some servers require a .shtml extension to use html includes.

edbr
07-17-2009, 08:30 AM
true but try it
<!--#include file="includes/your_file.html" -->
if not it could be added as 'add type .shtml :html' (not correct syntax) with .htaccess probably if on a unix server
if you do opt for php just be aware that if you have back links to your pages as a change of extension will cause you to lose them unless you use mod rewrite or 301 redirects.

DWcourse
07-17-2009, 01:18 PM
if you do opt for php just be aware that if you have back links to your pages as a change of extension will cause you to lose them unless you use mod rewrite or 301 redirects.
Absolutely!

It's also possible to tell the server to process .html files as php. I believe the correct syntax for the .htcaccess file is:

AddType application/x-httpd-php .php .phtml .php4 .php3 .html .htm

Also, if your site uses Cpanel, you can you can make the change there under the Advanced tab in Apache Handlers.

rap911help1
07-17-2009, 07:28 PM
Thank y'all.

It looks like my problem was that I was coding the includes manually ... so they worked on an Apache server but not in dreamweaver. I changed some (using the INSERT/SERVER-SIDE INCLUDE) and they displayed correctly.

My released website (I'm using a testsite on dreamwearver) uses .SHTML's but the Hosting system apparently made a change and the includes (they were all for the nav bar) didn't work {Found problem so everything good but in the process started looking at .php includes.)

Still wondering if upgrading to DW9 would be good ... looks like better CSS support?

DWcourse
07-17-2009, 07:34 PM
Actually 10 (CS4) is the current version and I thought it was a very worthwhile update. Here's what was new in Dreamweaver CS3 and CS4 (http://dwcourse.com/dreamweaver/upgrading-dreamweaver8-cs.php)