|
I want to be able to limit the amount of text printed from mysql in order to ensure it fits in the space I've made available. I know how to limit and cut based on character number, but this doesn't take into account a block of text that might have line breaks with few characters and consequently require many lines to display.
Is there a simple way to do this?
All I can think of doing is figuring out the number of characters that will fit across the width of the area and determine how many lines will fit. Then with the text block, find any <br> tags and make them worth the number of char across in order to then recalculate how many "characters" the text needs to be limited to. This seems very clumsy, though - I'm hoping there's a better way.
Thanks.
|