Using PHP Includes, Random Space Between Includes

15 replies
1

After my PHP include of my header and the small PHP include for my latest blog entry, there's a small line space. How can I get rid of it?
#includes #php #random #space
  • Profile picture of the author 2WDHost
    Hi Larches.

    Can you post that part of code here plus URL to the page where you see the unwanted line space?
    {{ DiscussionBoard.errors[5156815].message }}
  • Profile picture of the author SamJ
    It's because there are two separate elements (in your case tables), one for each page area.

    What you're going to want to do is edit your CSS and stop doing all background related styling as a table tag style.

    Then wrap your content area in a DIV, and do your background styling inside the DIV.

    Make sense? (I'm assuming you're a programmer)
    {{ DiscussionBoard.errors[5156835].message }}
  • Profile picture of the author 2WDHost
    Larches,

    Didn't notice "1" URL in your post. Sorry.

    Checked your site. The problem is in the last row of your Table_01. That is row with 1px height spacers. And that row is a line you see between your tables.
    {{ DiscussionBoard.errors[5156986].message }}
  • Profile picture of the author Neodism
    Ah! Thank you so much! I'm heading out of the office right now but I will try to fix that as soon as I get here in the morning and see if it works. Thanks, either way.
    Signature
    Free Web Design from Neodism.
    {{ DiscussionBoard.errors[5157665].message }}
    • Profile picture of the author 2WDHost
      Originally Posted by Larches View Post

      Ah! Thank you so much! I'm heading out of the office right now but I will try to fix that as soon as I get here in the morning and see if it works. Thanks, either way.
      No problem.
      It can be a bit tricky to fix it in your case by the way: simply removing the last row of Table_01 will break it.
      Let me know if you need any help with it.
      {{ DiscussionBoard.errors[5160516].message }}
      • Profile picture of the author Neodism
        Originally Posted by 2WDHost View Post

        No problem.
        It can be a bit tricky to fix it in your case by the way: simply removing the last row of Table_01 will break it.
        Let me know if you need any help with it.
        Well, I tried changing the spacers to be 0px height, but that didn't change a damn thing. =/ What do you suggest I do?
        Signature
        Free Web Design from Neodism.
        {{ DiscussionBoard.errors[5161885].message }}
        • Profile picture of the author 2WDHost
          Originally Posted by Larches View Post

          Well, I tried changing the spacers to be 0px height, but that didn't change a damn thing. =/ What do you suggest I do?
          Talking about quick solution in your case:
          It looks like Table_01 was created by graphics editor from the sliced image.
          You can remove the last row and try to rebuild the table manually using the current image slices, but I think the quick way for you would be to re-slice the image in your graphics editor to avoid colspans/rowspans in table. You should be able to safely remove the last row with spacers then.
          If you will go that way, then based on what you currently have in table I would suggest to split it into 3 separate tables:
          - Table 1: above the image with trees
          - Table 2: image with trees
          - Table 3: below the image with trees

          Let me know if you need further assistance with this.
          {{ DiscussionBoard.errors[5164811].message }}
  • Profile picture of the author Saulyx
    Had a quick look at your actual HTML, it's very messy and things like using same IDs for two elements is rather bad and invalid XHTML markup, might want to sort that out so google doesn't get annoyed
    Signature

    Web Development, Web Design, Scraper Creation(Automatic Content), Bug Fixing, APP development! www.scoding.com

    {{ DiscussionBoard.errors[5157904].message }}
  • Profile picture of the author Neodism
    I'm just going to deal with the space for right now. I've really gotta get this site up and going ASAP. But I would greatly appreciate it if you guys could direct me to a good tutorial for learning CSS beyond just styles. (Text, headers, etc.) I don't know much about CSS so actually, up until this point, I didn't know that it could really be used effectively for anything other than formatting text and such.

    I'd greatly appreciate it. I am going to get this all sorted out and then I'll brush up on CSS and come back to clean it up at a later point in time.
    Signature
    Free Web Design from Neodism.
    {{ DiscussionBoard.errors[5178082].message }}
    • Profile picture of the author 2WDHost
      Originally Posted by Larches View Post

      I'm just going to deal with the space for right now. I've really gotta get this site up and going ASAP. But I would greatly appreciate it if you guys could direct me to a good tutorial for learning CSS beyond just styles. (Text, headers, etc.) I don't know much about CSS so actually, up until this point, I didn't know that it could really be used effectively for anything other than formatting text and such.

      I'd greatly appreciate it. I am going to get this all sorted out and then I'll brush up on CSS and come back to clean it up at a later point in time.
      Larches,

      This should be useful for you at least at the very beginning:
      I'm unable to post the links yet, so please google "Tableless layout HOWTO" and check the first link (at w3.org).
      {{ DiscussionBoard.errors[5180908].message }}
  • Profile picture of the author Neodism
    Alright, everyone. I've redone the site in CSS rather than tables. But, I still have the same problem with my PHP includes. There's a space between the header/content and content/footer. Can anyone point me in the right direction?
    Signature
    Free Web Design from Neodism.
    {{ DiscussionBoard.errors[5220972].message }}
    • Profile picture of the author Terry Crim
      Originally Posted by Larches View Post

      Alright, everyone. I've redone the site in CSS rather than tables. But, I still have the same problem with my PHP includes. There's a space between the header/content and content/footer. Can anyone point me in the right direction?

      You need to paste your code so we can look at it.

      Looking at the source code for your main page there are many issues with the code. You have a redundant javascript section in the header that has nothing in it while a second one below it has the javascript.

      In the body of the content there are empty tables, rows and columns in what I would assume to be the footer section of the page there are empty rows and a table that is pushing things down the page.

      I am not sure what you are using to create this page but you should look into the table based layout generation because either your php is adding empty tables or the way the html is written in the php is the culprit.

      Personally I would get away from table based layouts unless you have content that is specifically suited for that.

      Since I can only see the end result with viewing your source code, I can't help further without seeing your php code.
      {{ DiscussionBoard.errors[5224373].message }}
      • Profile picture of the author Neodism
        HEADER:

        Code:
        <html>
        <head>
        <link href="css/layout.css" rel="stylesheet" type="text/css">
        <title>Touhstone Ranch</title>
        
        <style type="text/css">
        <!--
        body {
        	background-image: url(images/bg.png);
        }
        -->
        </style>
          <body>
            <div id="wrapper">
          <div id="header">
          	<div id="call"align="center"><img src="images/callnow.png" width="910" height="40" /></div>
            <div align="center"><span class="style6"><img src="images/head.png" alt="header" width="933" height="165"  /></span></div>
            <div id="navigation">
            <div id="links">
              <div align="center"><a href="index.php">Home</a> |<a href="programs.php"> Treatment Programs</a> |<a href="pictures.php"> Pictures</a> | <a href="testimonials.php">Testimonials</a> |<a href="about.php"> About Us</a> | <a href="http://equinetherapytexas.com">Blog</a></div>
            </div>
          	</div>
        </div>
        INDEX:

        Code:
        <?php include "header.php"; ?>
        <div id="body">
                <div id="content">
                  <div id="cleft">Content.</div>
              </div>
        </div>
        <?php include "footer.php" ; ?>

        FOOTER:

        Code:
        <link href="css/layout.css" rel="stylesheet" type="text/css">
          <div id="footer">
            <div id="nav">
              <div align="center">
                <p><a href="index.html">Home</a> - <a href="programs.html">Treatment Programs</a> - <a href="pictures.php">Pictures</a> - <a href="testimonials.html">Testimonials</a> - <a href="about.html">About Us</a> - <a href="http://www.equinetherapytexas.com">Blog</a></p>
                <p>2011 Touchstone Ranch Recovery Center</p>
                <p>P.O. Box 1519 Stephenville, Texas 76401</p>
              </div>
            </div>
            <div id="social">
              <div align="center"><a href="http://www.facebook.com/touchstoneranchrecoverycenter"><img src="images/fb.png" width="53" height="54" /></a> <img src="images/in.png" width="53" height="53" /> <a href="http://www.twitter.com/touchstoneranch"><img src="images/twit.png" width="52" height="53" /></a>        </div>
            </div>
          </div>
            </div>
            </div>
          </body>
        </html>
        Signature
        Free Web Design from Neodism.
        {{ DiscussionBoard.errors[5227779].message }}
  • Profile picture of the author Neodism
    I'm getting desperate for help with this. I apologize for the bump.
    Signature
    Free Web Design from Neodism.
    {{ DiscussionBoard.errors[5221640].message }}
  • Profile picture of the author Neodism
    Touhstone Ranch I have done it in CSS. I thought I left a link to what I'm working with, sorry. But yeah, I've done it with CSS and I'm getting those blank spaces. They are the only thing between me and launching the site.


    But, I've learned that if I take the <p> tags off my place-holder content, the spaces go away. So it is not the CSS or the PHP includes that are causing this dilemma, it is my <p> tags.

    So, I need a fix to this problem. I tried putting the margin and padding for my #content p to 0, but that didn't work. I Don't think I can make this thing happen without paragraph tags, either.
    Signature
    Free Web Design from Neodism.
    {{ DiscussionBoard.errors[5227647].message }}

Trending Topics