Jump to content

Anyone else get wierd margins on top of elements that you php require() ?


scottfennell

Recommended Posts

I am trying to php require() a header, footer, and sidebars for www.sacosolarstore.com .  When I have tried to do this, I get wierd margins above the elements when they appear in the page that requires them, except for the footer, which displays correctly.

 

Here is another version of the home page, but with php require()s for the elements that repeat on multiple pages.

 

http://www.sacosolarstore.com/index1.php

 

I have tried zeroing out every margin and padding I could think of on my style sheet.

 

Any ideas?

 

Scott

(novice)

The only thing I can see is when viewing the source an unwanted character appears... see screenie for details.

 

Check your script to make sure there aren't any extra spaces outside your <?php ?> tags

 

[attachment deleted by admin]

Thank you for the attempt, but that does not seem to solve it.  Although I am not getting the unwanted character anymore, now that I have removed all extra spaces outside of the tags.

 

Another thing I have noticed that will maybe help diagnose:

 

When I require() the <div> tags, I get extra margin on top.  When I leave the <div> tags in the original layout and just require() the contents of the div, I get extra padding instead.

 

I'm kind of stumped.  Anyone?

There is something in your code or files causing the symptom, because a require() statement only literally inserts the code in the required file at the point where the require() statement is placed.

 

Post one of your require() statements and show about five lines of code before the require() statement. Post the whole content of the corresponding required file.

Here is about 5 lines of code and my first require() statement:

 

 

 

 

 

<link rel="stylesheet" type="text/css" href="style.css" media="screen"/>

 

</head>

 

<body>

 

<div id="wrap">

 

<?php require('header.htm');

?>

 

 

 

 

 

 

 

 

 

Here is the file being require()d

 

<div id="header">

<ul id ="contactinfo">

<li>The Saco Solar Store</li>

<li>743 Portland Road (Route 1)</li>

<li>Saco, ME 04072</li>

<li>(207)283-1413</li>

<li>Open: Mon-Fri: 9-5, Sat: 10-2</li>

<li><a href="mailto:[email protected]">Email</a></li>

</ul>

</div>

 

 

 

 

 

 

 

Something else I noticed:  While tinkering, I tried including the div tags in both the original layout and in the require()d file.  However, I forgot to include closing quotation marks in the div id in the original layout while I was tinkering with it.  The result was that it closed my wrap div, but I also was not getting the wierd margin or padding!

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.