MoombaDS Posted October 24, 2007 Share Posted October 24, 2007 Not entirely sure whether to stick this under the Maths section but anyway: I was wondering if anyone can show me a PHP script (My php scripting skills are pretty basic) that would calculate the height of a table (the height of the table isn't defined, it resizes with content), divide the height by 142, round the answer up to the nearest whole number and then multiply that answer by 142 before finally setting the height of the table in question to that final answer. e.g. Table Height is 390 Dividing 390 by 142 gives 2.75 (roughly) Round 2.75 up to 3. Multiply 3 by 142 gives 426. Set the table height to 426. If anyone could help me on this I would be eternally greatful. Thank you. Quote Link to comment Share on other sites More sharing options...
Wuhtzu Posted October 24, 2007 Share Posted October 24, 2007 May I ask why you wanna do this? <?php $old_height = 390; $new_height = ceil($old_height / 142) * 142; ?> <table height="<?php echo $new_height; ?>"> <tr> <td>Why?</td> </tr> </table> Quote Link to comment Share on other sites More sharing options...
Wuhtzu Posted October 24, 2007 Share Posted October 24, 2007 But what you wanna do is not possible since PHP is serverside and the "resizes with content" is done client side based on lots of things like the users browser window, browser font size ect. So you can't get PHP to obtain the height of a table, calculate a new height and display the table again... not possible Quote Link to comment Share on other sites More sharing options...
MoombaDS Posted October 24, 2007 Author Share Posted October 24, 2007 mmm you're right about that. I forgot to think about it. Problem I'm having is here: http://www.ffinsight.com/uploads/index2.php You'll notice near the bottom that there's a line where the repeating background cell doesn't mesh with the footer. The repeating cell is actually designed to mesh with the footer, but only if it repeats to it's full height (the height is 142px, so the table height would need to be a multiple of 142). This was one of the only ways I could think of correcting it, having been unable to find a solution in HTML or CSS. Is there any way to force the table to only ever increase by 142px? Quote Link to comment 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.