View Full Version : Using Includes in DW 8

07-21-2009, 07:03 PM
Ended up with good info from "PHP Include Support in DW?" thread (in this forum) but have another question/problem using includes.

Background: have website with .SHTML includes ... worked fine until hosting service changed the configuration - works now but had to change coding of includes. Went to .SHTML long ago because it was only way at the time to use SSI. Now I see that in .htaccess (via ADDTYPE, ADDHANDLER, etc) HTML can be used.

In searching for an include 'fix' for current website/SHTML, I was pointed to .php files to use for including. Additionally, it was recommended that tags such as DOCTYPE, head, links, etc be placed in an 'over_all' include to be used for each page.
Thus having a 'base' php file for each page - each including the 'over_all' header AND an include for unique content(main HTML).

I've tested this and it works .... only problem is it's not so good using DW (not convenient and time consuming) - have to use the 'base' .php file for DESIGN tab, but when go to CODE tab, DW 'returns' me to the 'base' file NOT the unique content file (where I want to make the change). Also, since the unique content file consists of only content (duh) and not links to CSS files, I don't get the benefit of the CSS Panel.

Am I approaching this wrong? Is there a feature of DW that would help?

07-22-2009, 02:31 AM
Read some other threads and thought ... why not 'run' the unique content file and include header, etc from there. Worked in DW but had problems at host. Includes didn't work. Suspect .htaccess - though it has:

AddType application/x-httpd-php .php .html
AddHandler server-parsed .html .shtml
AddHandler application/x-httpd-php .html .htm
Will do some internet searching while awaiting a response.

07-22-2009, 04:10 AM
Have tried many combo's - this seems to work. Am I just lucky? Is my approach flawed? Realize this has gotten a little away from DW - but all host tests are preceded by a DW test to make sure I can diagnose / troubleshoot there.

Am testing in /public_html/testsite but .htaccess is only in /public_html/.
.htaccess contains:

AddHandler server-parsed .html .shtml
AddHandler application/x-httpd-php .html .htm
AddType application/x-httpd-php .html .php
DirectoryIndex index.php index.html
Options +Includes

main.php is the file for my test page and can be 'run' in DW. It is:

<?php require_once('HtmlHdr.php'); ?>
contains Doctype, html,
head, and some meta's>
<?php require_once('UniqHdr.php'); ?>
contains unique styles,
CSS links, more meta's, /head, and <body>
<?php require_once('topNav.php'); ?>

<h4 class="nobold">... rest
of content, /body, and /html

Am I really off track?