View Full Version : Extra spacing caused by PHP?
Grant Palin
04-28-2003, 08:54 PM
I've got a website which uses PHP to include navigation buttons into each page. I've noticed that on some pages, the table cell the include is in is just large enough for the buttons. But on some other pages, there is extra spacing between the buttons and the bottom of the table cell with the PHP include. Use the link below to go to one of my pages to see what I mean. It's the top cell I'm talking about. Try some of the other top links- notice how some pages have smaller tables than others?
http://www.hommworld.net/Homm/links.php
I'm wondering if this is something done by PHP, because I'm pretty sure that I'm not doing it in my HTML. Has anyone else had this problem and know how to correct it?
Here's the include for the page that I linked to.
<table border="1" width="100%" cellspacing="0" cellpadding="0">
<tr>
<td rowspan="2" valign="top" width="8%">
<? include("leftNav.php") ?>
</td>
<td valign="top">
<? include("topNav.php") ?>
</td>
</tr>
Could there be something in this code that causes the extra spacing? If you think it relevant, I can provide the code for the included pages also. But I don't think that's what it is because the includes do work properly on some pages (Home, Where to Buy).
Any help is appreciated. I'm really puzzled about this.
Nightfire
04-28-2003, 09:02 PM
PHP has nothing to do with html spacing. I guess you're talking about the stupid IE bug which creates 'space' in cells, even when you don't want it to?
Just do this instead
<table border="1" width="100%" cellspacing="0" cellpadding="0">
<tr>
<td rowspan="2" valign="top" width="8%"><? include("leftNav.php") ?></td>
<td valign="top"><? include("topNav.php") ?></td>
</tr>
Grant Palin
04-28-2003, 09:08 PM
I tried that, but no change.:( Funny you should mention that Internet Explorer bug though, since I'm getting the same result in Navigator 4.7 and 6.:confused:
Any other suggestions?
duniyadnd
04-28-2003, 10:51 PM
could you post the code in leftnav and topnav??
Thanks
Duniyadnd
Grant Palin
04-29-2003, 01:49 AM
leftNav.php
<table border="0" cellspacing="5" cellpadding="0" class="nav">
<tr>
<td><img src="HOMM_title.gif" width="75" height="35" border="0" alt="Heroes of Might and Magic" /></td>
</tr>
<tr>
<td><a href="screenshots.php"><img src="screenshots_button.jpg" width="75" height="34" border="0" alt="Screenshots" /></a></td>
</tr>
<tr>
<td><a href="heroes.php"><img src="heroes_button.jpg" width="75" height="34" border="0" alt="Heroes" /></a></td>
</tr>
<tr>
<td><a href="artifacts.php"><img src="artifacts_button.jpg" width="75" height="34" border="0" alt="Artifacts" /></a></td>
</tr>
<tr>
<td><a href="creatures.php"><img src="creatures_button.jpg" width="75" height="34" border="0" alt="Creatures" /></a></td>
</tr>
<tr>
<td><a href="castles.php"><img src="castles_button.jpg" width="75" height="34" border="0" alt="Castles" /></a></td>
</tr>
<tr>
<td><a href="spells.php"><img src="spells_button.jpg" width="75" height="34" border="0" alt="Spells" /></a></td>
</tr>
<tr>
<td><a href="map_locations.php"><img src="maplocations_button.jpg" width="75" height="34" border="0" alt="Map Locations" /></a></td>
</tr>
<tr>
<td><a href="general_info.php"><img src="general_button.jpg" width="75" height="34" border="0" alt="General Information" /></a></td>
</tr>
<tr>
<td><a href="general_strategy.php"><img src="general_strategy_button.jpg" width="75" height="34" border="0" alt="General Strategy" /></a></td>
</tr>
<tr>
<td><a href="campaign.php"><img src="campaign_button.jpg" width="75" height="34" border="0" alt="Campaign" /></a></td>
</tr>
</table>
topNav.php
<table border="0" cellspacing="5" cellpadding="0" class="nav">
<tr>
<td><a href="index.php"><img src="home_button.jpg" width="75" height="34" border="0" alt="Home" /></a></td>
<td><a href="links.php"><img src="links_button.jpg" width="75" height="34" border="0" alt="Links" /></a></td>
<td><a href="where_to_buy.php"><img src="wheretobuy_button.jpg" width="75" height="34" border="0" alt="Where to Buy" /></a></td>
<td><a href="downloads.php"><img src="downloads_button.jpg" width="75" height="34" border="0" alt="Downloads" /></a></td>
<td><a href="copyright_info.php"><img src="copyright_button.jpg" width="75" height="34" border="0" alt="Copyright Info" /></a></td>
<td><a href="contact.php"><img src="contact_button.jpg" width="75" height="34" border="0" alt="Contact Me!" /></a></td>
<td><a href="http://www.freewebz.com/hommworld/index.html"><img src="homepage_button.jpg" width="75" height="34" border="0" alt="Go to my Homepage!" /></a></td>
</tr>
</table>
duniyadnd
04-30-2003, 08:36 AM
Okay.. simple problem, not a php problem.
Cellpadding="5"
Change both of them to
cellpadding="0"
That should reduce it.
As for the gap left after that, that's because the column is so long on the leftNav that it has to extend it. Nothing you can do about that unless you have more material in the middle.
Duniyadnd
Grant Palin
04-30-2003, 04:29 PM
cellpadding="5" ??? Where's that? I don't see any cellpadding="5". Do you mean cellspacing?
duniyadnd
04-30-2003, 04:48 PM
my mistake.. i meant cellspacing
Grant Palin
05-01-2003, 01:08 AM
Okay, that reduced the extra spacing a bit. Some of the pages still have some extra spacing left in them (I haven't uploaded them yet). Why on earth would that be happening? That makes no sense to me, having the extra spacing on some pages but not on others.
Spookster
05-01-2003, 01:21 AM
Since this will not be a PHP problem per say I will move this to the HTML forum.
Grant Palin
05-05-2003, 04:38 AM
Okay, I seem to have figured it out. I just restructured the layout table on my page, and the extra spacing is gone now. Don't know why those tables were getting extra space in them, but it's fixed now.
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.