Picatta Posted July 25, 2006 Share Posted July 25, 2006 I was re-doing my website, but ran into a problem. The top and bottomof my pages are brought up in includes, so I can't change one script wthout the rest getting messed up. The problem is that while rowspan=4 i fine on most of my pages, some have more than 4 rows, and so do not work properly. An example is http://picatta.homeip.net/googlemediasearch.php. On the menu to the right, it is too short. Is there a way of having it automatically resize to the number of table rows?NOTE: I set rowspan to a large number, and it seems to work. However, is there a better way of doing it? Quote Link to comment https://forums.phpfreaks.com/topic/15562-auto-resizing-rowspan-for-table-column/ Share on other sites More sharing options...
just-j Posted July 26, 2006 Share Posted July 26, 2006 i dont know if you can do it it javascript but i did mine in php somthing like[code]$textlen = strlen($line);$rowspan = (round($textlen / 80) + 1);if ($colspan < 4) { $rowspan = 4; }[/code]where $line = what i want to say in that <td>and 80 is where i want the text to wrap around and i used wordwrap() for that. i had to round the number so i didnt get a decimal place then i added 1 just in case it rounded down. the if (....) statement is used because i want the rowspan to be at least 4and for it to work i use echo "<td rowspan='$rowspan'>";if you dont know php and dont have it installed then you cant do it...i dont know if rowspan="auto" will work. i dont think it does though.. so learn php unless someone else has a solution.. im sure someone can do a javascript version similar to what i did in PHP that you would be able to use without having to install anything new on your server. Quote Link to comment https://forums.phpfreaks.com/topic/15562-auto-resizing-rowspan-for-table-column/#findComment-63835 Share on other sites More sharing options...
foreverhex Posted July 28, 2006 Share Posted July 28, 2006 I use embeded tables for this situation. Or seprerate tables. EX:[code]<table width="775"><!--This table controls the overall shape of the page --><tr><td><table><tr><td>The top/banner</td></tr></table><table><tr><td>Content</td></tr></table><table><tr><td>Footer/bottom</td></tr></table></td></tr></table>[/code]And you can add as many rows and cols as you want in each table with out them screwing up the over all layout. You can also put you php includes in repalce of the tables that way you can edit everything seperately. Hope that helps a little.[/code Quote Link to comment https://forums.phpfreaks.com/topic/15562-auto-resizing-rowspan-for-table-column/#findComment-65142 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.