Jump to content

PHP require function creates display problem in DreamWeaver CS3 Design Mode


Recommended Posts

Hello Experts! Here is my problem:

 

I created a header.php file that I'm going to "php require" in many pages of my website. I am expecting to often edit this header in the future to replace some pictures, add navigation button etc...) and I don't want to spend a lot of time to edit every single page and transfer the whole site at every modification!!

 

Until this point, everything is working great when I preview and on my hosting server...

N.B.: I'm using DreamWeaver CS3.

 

The problem I have is that when I want to use the Design Mode in DW to create a new pages that is using the "require", instead of displaying the header.php and thena blank page that I can edit, it displays only the header.php and doesn't let me work on the rest of the page.

 

I tried to pud the <?php require fonction on the top of my HTML code, between the Head and Body section, at the beginning of the Body and that doesn't make any difference!

 

The "bypass" i'm doing right now is to put my require command in "comments  /*  & */ to prevent DW from reading the require function until my webpage is finished and then I remove the "comment".

 

Is there any way that I could avoid doing this bypass and still being able to design my page in Design Mode?  I would like to be able to preview my header in Design Mode so I can visually align the page elements with the header elements...

 

Maxime

Link to comment
Share on other sites

Dreamweaver wont be able to understand PHP so you get virtually no output when you go to Design View just a bunch of PHP images representing where you PHP code is.

 

The best thing to do is to setup a Site Definition to your live/development server. You should then manually modify your code via Code View. To preview your changes you should swap to your web browser and navigate to your live/development site. This is only possible way.

Link to comment
Share on other sites

Thank you WildTeen88 for your answer.

 

However, this is not exactly the answer I was expecting...

 

In fact, Dreamweaver seems to understand and interpret PHP as the header.php file appears in design mode of the pages where I use the Include function. The Problem is that everything else than the include (header.pho) will NOT appear ?!?!

 

Anyway, this is what I'm doing right now. I have wampserver installed and I use the Dreamweaver F12 function (preview with browser) very often ;-)!!

 

Because I'm a beginner, I prefer building in design mode than in code mode... This is why I was hoping to visualize the include + the actual page directly into Dreamweaver to ease the creation of my pages...

 

SniperScope, I start every pages with blank php pages?!  Why are you saying that?! What can be the link with display problem when using php code and templates??

 

Maxime

Link to comment
Share on other sites

  • 3 weeks later...

Ok I got the solution

 

same in REQUIRE or INCLUDE

 

Just replace youre your code

 

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

 

With this one

 

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

 

Did you have the difference, if not, the @ symbol in added before the word include or 'require'!

 

Hope this will work

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.