Using PHP Includes, Random Space Between Includes

by 15 replies
18
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?
#programming #includes #php #random #space
  • Hi Larches.

    Can you post that part of code here plus URL to the page where you see the unwanted line space?
  • 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)
    • [ 1 ] Thanks
  • 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.
    • [ 1 ] Thanks
  • 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.
    • [1] reply
    • 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.
      • [1] reply
  • 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
  • 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.
    • [1] reply
    • 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).
  • 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?
    • [1] reply

    • 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.
      • [1] reply
  • I'm getting desperate for help with this. I apologize for the bump.
  • 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.

Next Topics on Trending Feed