Jump to content

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


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:saco@usasolarstore.com">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!

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.