To register for an Internet.com membership to receive newsletters and white papers, use the Register button ABOVE.
To participate in the message forums BELOW, click here
PHPBuilder.com  
 

 

Go Back   PHPBuilder.com > Tools > Dreamweaver

Dreamweaver In need of help with Dreamweaver?

Reply
 
Thread Tools Rate Thread Display Modes
Old 01-14-2004, 03:51 PM   #1
tpozzy
Junior Member
 
Join Date: Jan 2004
Posts: 1
Question Problems with DWMX (and DWMX04) handling of PHP include files

Warning: this message is detailed, but I'm really looking for some specific help, so I wanted to provide all the background up front.

I am working on a large site that is all PHP scripts, using Dreamweaver MX for editing. What I am trying to do is set up an environment where certain shared page elements can be used in a template via PHP includes, rather than DW libraries. This is to reduce the number of pages that must be synchronized when an element of the page changes.

The basic problem I'm having is one of dealing with include paths and include file references. First, it is important to me to have DreamWeaver render the included files, as they contain HTML. Related to that, I have my first questions:

1. Why does DWMX only support include statements (include, require, include_once, require_once) that are alone in segment of PHP code, and only if the file name argument is enclosed in parentheses? For example, the following, both valid PHP syntax, don't get rendered:

<?php
include "include_file.inc.php"; // include ("incfile.inc.php"); renders correctly
?>
<?php
include("file1.inc.php"); // neither of these files are rendered
include("file2.inc.php"); // and any other PHP statements before or after the include prevent rendering also
?>

My second issue/question is about path names. For PHP include files, DWMX seems to understand both document and site-relative paths for include files, when it comes to rendering them. If you use a site-relative path, interestingly enough, DWMX converts it into a document-relative path in the generated temp file for a preview.

The problem is that PHP doesn't itself deal with site-relative paths. So if you have an include statement like:

<?php include("/include/incfile.inc.php"); ?>

DWMX will find it, include in the preview (due to the path mangling noted above), but when you try to view it directly from the web server in a browser, you get an error about not being able to find the file.

On the PHP side of things, I have tried two things. The first was to set the PHP config variable "doc_root" to the root directory for the site. I have tried this under WinXP/IIS and Linux/Apache, and it doesn't work for either. Note: I do *not* have safe mode set, and don't want to enable that (and I read somewhere that that solution won't help for include files, but I didn't test it).

My second thought was to put the root document directory into the PHP include_path, and use root-relative path names. This worked great for PHP, and DWMX worked correctly for PHP files in the root directory, since the root-relative and document-relative paths are the same. But a page one or more levels down the tree from the root will not render correctly, as I'm sure DWMX doesn't support or understand the PHP include_path.

So what's the solution to get include files that you want rendered in DWMX to work? I'm *sure I'm not the first one to grapple with this issue! Any help would be greatly appreciated.

Sincerely,
Theo Pozzy
tpozzy is offline   Reply With Quote
Old 01-21-2004, 02:59 PM   #2
kramnic
Junior Member
 
kramnic's Avatar
 
Join Date: Jan 2004
Posts: 2
Re: problems with DWMX

4 the moment I have the answer to your first question(I'm still trying to understand the second one and translating in Italian, so wait a little 4 that :-) ).

DWMX gave me a lot of problems in this way, because I didn't understand that the code
<? include "file" ; ?> may be the same as include_once , but with strange errors connected to that.

Probably the server understand this code like a unique request string, so doesn't allow you to repeat the query again in the same script.

Since I began to write <? include ("file") ; ?> I didn't find this error anymore.

So, try to code in that way.

I hope you'll understand my English, but hey I'm working on it :-) .

Mail me if I helped you.

Bye

Kramnic
kramnic is offline   Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT -4. The time now is 11:46 AM.






Acceptable Use Policy

internet.comMediabistrojusttechjobs.comGraphics.com

WebMediaBrands Corporate Info


Advertise | Newsletters | Feedback | Submit News

Legal Notices | Licensing | Permissions | Privacy Policy


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.