Jump to content

Accounting for line breaks


jcbarr

Recommended Posts

I have a script that reads a text field from a database and then I display it on the page. I check the string length and if it is greater than the threshold for display I then use substr to cut it down and echo a link to the whole article.

 

My question is, how would I account for line breaks. The area of the page that the article blurb goes has a static size, and when line breaks are present it destroys the layout of the page.

 

I know that isn't efficent web design, but that isn't my duty, I'm just the coder.

 

So is there anyway to account for the line breaks and string length so as to truncate the text to make sure it always fits in the display box?

Link to comment
https://forums.phpfreaks.com/topic/39566-accounting-for-line-breaks/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.