• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Does PHP break Dreamweaver's functions and preview?

fuzzybabybunny

Moderator<br>Digital & Video Cameras
Moderator
So I have a simple page that's like this that previews just fine in dreamweaver.

<body>

<div id="container"> (1000px wide, centered on the page)

<div id="header">
STUFF
</div>

<div id="content">
STUFF
</div>

</div>

</body>

If I put in a simple PHP include (footer.php):

<body>

<div id="footer">

Copyright © 2009, Victor Lin Photography.

</div>

</body>

and insert it here:

<body>

<div id="container"> (1000px wide, centered on the page)

<div id="header">
STUFF
</div>

<div id="content">
STUFF
</div>

<?php include("footer.php"); ?>

</div>

</body>

all of a sudden in Dreamweaver's preview the page is no longer centered and the program thinks <div id="container"> doesn't have an ending </div> anymore. It's like adding that php include just disconnected the "container" div as far as Dreamweaver is concerned. It still displays right in the browser, but not in Dreamweaver.

EDIT:

My code, and what DW preview shows. It thinks that the "container" div is not closed... and I have no idea why it shows </head> highlighted...:

http://www.victorlinphoto.com/images/Capture.JPG

What it SHOULD show:

http://www.victorlinphoto.com/landscapes/index.php

<head>
<title>Victor Lin Landscape Photography</title>
<style type="text/css">
<!--
@import url("../css/master.css");
@import url("../css/site.css");
-->
</style>
</head>

<body id="header_big">
<div id="container"> //(centers page, 1000px wide)

<div id="header">
<BR /><BR />
<img src="../images/header_images/landscape_header.jpg" alt="Flash to go here" />
</div>


<div id="nav">

<div id="nav_left">
<ul>
<li><a href="../index.html" >HOME</a></li>
<li>|</li>
<li><a href="../passion.php" >PASSION</a></li>
<li>|</li>
<li><a href="../contact.html" >CONTACT</a></li>
</ul>
</div>


<div id="nav_right">
<ul>
<li><a href="../landscapes/index.php" class="navon"><img src="../images/nav/nav_landscapes.jpg" alt="Landscapes" /></a></li>
<li>|</li>
<li><a href="../cityscapes/index.php" ><img src="../images/nav/nav_cityscapes.jpg" alt="Cityscapes" /></a></li>
<li>|</li>
<li style="margin-right:0px;"><a href="../realestate/index.php" ><img src="../images/nav/nav_realestate.jpg" alt="Real Estate" /></a></li>
</ul>
</div>


</div>

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

</div>
 
You don't need 2 sets of body tags, just one will suffice. Include() essentially copies and pastes the code into the page. That is why by convetntion you should name it footer.inc.php to know that it is an include file. And if you can't live without the file being included, use require() instead so it will throw an error if it is missing.
 
Ahhhhh.... that makes total sense. So all the php include file would need is the code and the css link? No head, no body, no meta, no doctype...

Looks like it's working. Thanks!
 
Back
Top