Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Limit lines printed to fit in table area
Old 05-18-2010, 04:55 PM Limit lines printed to fit in table area
Skilled Talker

Posts: 61
Trades: 0
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.
gregory is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 05-18-2010, 05:34 PM Re: Limit lines printed to fit in table area
Phunk Rabbit's Avatar
Ultra Talker

Posts: 255
Name: John Nerush
Location: Milton Keynes, UK
Trades: 0
What about using overflow:hidden (css) on the table cell, I cant remember if this will work with a <td> if not then pop a div or p in the cell.

Im not sure what you could use in PHP to pick up on line breaks, obviously nl2br(); converts line breaks but im unsure if it attually echo's <br>'s into your text.
Phunk Rabbit is offline
Reply With Quote
View Public Profile Visit Phunk Rabbit's homepage!
 
Old 05-18-2010, 05:35 PM Re: Limit lines printed to fit in table area
Skilled Talker

Posts: 61
Trades: 0
good idea. i will give it a try. thanks.
gregory is offline
Reply With Quote
View Public Profile
 
Old 05-18-2010, 05:42 PM Re: Limit lines printed to fit in table area
Skilled Talker

Posts: 61
Trades: 0
works great. thanks again.
gregory is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Limit lines printed to fit in table area
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.13015 seconds with 12 queries