arbitter Posted March 28, 2010 Share Posted March 28, 2010 I have a php file with table-layout, but my td's don't line up( but they do) I'll sketch it quickly: <table> <tr> <td>//in notepad++ this doesn't get linked to the td aligned with this one <table> // this table is fully recognized until <tr> <td> echo "Lot's and lots of content"; </tr> </table>// until here. so that's not the problem </td> </tr> </table> And because of that, when I try to validate my file, it gives loads of errors... (In notepad++ if you click on the beginning of a tag, it shows the endingtag too so you see if it's correct or not;) how it should be: (and to show my table within the td is correct) the problem: Quote Link to comment https://forums.phpfreaks.com/topic/196807-tables-inside-tables/ Share on other sites More sharing options...
zeodragonzord Posted March 28, 2010 Share Posted March 28, 2010 You missed a closing </td> after echo "Lot's and lots of content"; <table> <tr> <td>//in notepad++ this doesn't get linked to the td aligned with this one <table> // this table is fully recognized until <tr> <td> echo "Lot's and lots of content"; </td> </tr> </table>// until here. so that's not the problem </td> </tr> </table> Quote Link to comment https://forums.phpfreaks.com/topic/196807-tables-inside-tables/#findComment-1033126 Share on other sites More sharing options...
arbitter Posted March 28, 2010 Author Share Posted March 28, 2010 Oh my bad, but in my file it's all closed, doublechecked it. So that's not the problem. I can give the whole thing, but it's kind of big and I don't think you'd really get out of it fast, so that's why I put it here simplified.. Quote Link to comment https://forums.phpfreaks.com/topic/196807-tables-inside-tables/#findComment-1033160 Share on other sites More sharing options...
zeodragonzord Posted March 28, 2010 Share Posted March 28, 2010 Yea, feel free to post it. Also, I noticed that you have a <?php towards the end of the code shown in the screenshot. Perhaps that's messing things up? Quote Link to comment https://forums.phpfreaks.com/topic/196807-tables-inside-tables/#findComment-1033194 Share on other sites More sharing options...
arbitter Posted March 29, 2010 Author Share Posted March 29, 2010 The php is properly closed, no worries there. I'll post the whole thing <table width="100%"> <tr> <td width="200" align="left" valign="top"> <table width='200' align='left'> <tr> <td rowspan='100'> </td> <td colspan='2'> </td> </tr> <tr> <td height='100%' colspan='2'> </td> </tr> <tr> <td align='center' colspan='2'><b>Kies een maand</b></td> </tr> <?php /* Directories zoeken en rangschikken nieuw vanboven */ $dirs = glob('*',GLOB_ONLYDIR|GLOB_NOSORT); foreach($dirs as $dir) { $sortedDirs[filemtime($dir)] = $dir; } ksort($sortedDirs); foreach (($sortedDirs) as $map) { $qmap = urlencode($map); if(isset($_GET['sort'])){ if(urlencode($_GET['month']) == $qmap){ $kl1 = $kleurachtergrond; $kl11= $kleurletter; } else{ $kl1='white'; $kl11='black'; } echo "<tr><td colspan='2' bgcolor='$kl1' width='200' align='center' valign='middle' style='cursor:pointer' onclick=\"location.href='?month=$qmap&sort=$sort'\"><font color='$kl11'>$map</font></td></tr>"; } else{ if(urlencode($_GET['month']) == $qmap){ $kl1 = $kleurachtergrond; $kl11=$kleurletter; } else{ $kl1='white'; $kl11='black'; } echo "<tr><td colspan='2' bgcolor='$kl1' width='200' align='center' valign='middle' style='cursor:pointer' onclick=\"location.href='?month=$qmap&sort=ksort'\"><font color='$kl11'>$map</font></td></tr>";} } /* als er een maand is aangegeven, word die opgeslagen in een sessie. Als die bestaat */ $maand = $_SESSION['month']; $qmaand = urlencode($maand); if (isset($maand)){ echo "<tr><td colspan='2'> </td></tr><tr><td colspan='2' align='center'><b>Sorteren op:</b></td></tr>"; if($_GET['sort'] != 'ksort'){ $kleur2 = $kleurachtergrond; $kleur22 = $kleurletter; $kleur1 = 'white'; $kleur11 = 'black'; } else{ $kleur1=$kleurachtergrond; $kleur11 = $kleurletter; $kleur2='white'; $kleur22='black'; } echo "<tr valign='bottom'><td bgcolor='$kleur1' width='200' align='center' valign='bottom' style='cursor:pointer' onclick=\"location.href='?month=$qmaand&sort=ksort'\"><font color='$kleur11'>oudste</font></td> <td bgcolor='$kleur2' width='200' align='center' valign='bottom' style='cursor:pointer' onclick=\"location.href='?month=$qmaand&sort=krsort'\"><font color='$kleur22'>nieuwste</font></td></tr>";} ?> </table> </td> <td width="824" align="left" valign="top"> <div class='first'> <?php $images = glob($_SESSION['month'] . '/*.{jpg,gif,jpeg,pjpeg,image,JPEG}', GLOB_BRACE|GLOB_NOSORT); if (isset($maand)){ if (isset($images)){ foreach ($images as $image) {$sortedimages[filemtime($image)] = $image; } if ($sort2 == 'ksort'){ ksort($sortedimages); foreach (($sortedimages) as $afbeelding) { echo "<br /><center><img src=\"$afbeelding\" class='first' alt='foto' /></center><br />";}} elseif($_GET['sort'] == 'krsort'){ krsort($sortedimages); foreach (($sortedimages) as $afbeelding) { echo "<br /><center><img src=\"$afbeelding\" class='first' alt='foto' /></center><br />";}} else{echo " ";}} else {echo " ";}} ?> </div> </td> </tr> </table> Quote Link to comment https://forums.phpfreaks.com/topic/196807-tables-inside-tables/#findComment-1033408 Share on other sites More sharing options...
zeodragonzord Posted March 29, 2010 Share Posted March 29, 2010 My IDE was able to highlight both start and end tags for the <td></td>. Maybe the problem happens when the page is rendered. What does the error say when you validate it? Check to see what the source looks like when it's rendered and try pasting that into Notepad++ to determine if the tags line up. Quote Link to comment https://forums.phpfreaks.com/topic/196807-tables-inside-tables/#findComment-1033442 Share on other sites More sharing options...
arbitter Posted March 29, 2010 Author Share Posted March 29, 2010 Oh my how peculiar. I started editing my file yesterday, via w3c. But I got 53 errors, including the errors with the <td>. I patched up all the other 20 problems, (though I never interfered with any td,tr, or tables) and was wainting to see what to do with this. But by checking it now, with the other 20 errors fixed, it suddenly passed! Though notepad++ still doesn't link the two td's. Anyway, it's validadet now, thanks a lot! Quote Link to comment https://forums.phpfreaks.com/topic/196807-tables-inside-tables/#findComment-1033452 Share on other sites More sharing options...
haku Posted March 30, 2010 Share Posted March 30, 2010 Errors cascade. One error at the top of a document turns into 20 errors below it, as the validator gets confused. So it's always good to fix the first error, then re-test. If you start trying to fix errors further down the page, they may not actually be an error, and in fixing it, you just have to re-fix it later on. Quote Link to comment https://forums.phpfreaks.com/topic/196807-tables-inside-tables/#findComment-1034172 Share on other sites More sharing options...
arbitter Posted March 30, 2010 Author Share Posted March 30, 2010 Indeed, but the only errors were som <br> instead of <br /> and forgot the alt='alt' in the images. Perhaps some other little flaws, so I didn't think that would interfere. Good to know that I have to test it after fixing a few errors, so I don't spam this forum! Quote Link to comment https://forums.phpfreaks.com/topic/196807-tables-inside-tables/#findComment-1034175 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.