Guest Posted September 23, 2012 Share Posted September 23, 2012 When I do a IPSText::truncate( $s['s_message'], 100 ); If there is html in the startup it is counted towards the length of the string. This means that the shortened text (visually) can be dramatically less than the required number of characters. What I think needs to happen is that the tags need to be stripped and the offset calculated without the html and then that offset translated into the formatted string. I know easy for me to say :tongue: Link to comment Share on other sites More sharing options...
.Ian Posted September 24, 2012 Share Posted September 24, 2012 Just implemented this , I would agree :) - had to extend the truncate by a few more to take into account the html Link to comment Share on other sites More sharing options...
bfarber Posted September 24, 2012 Share Posted September 24, 2012 When I do a IPSText::truncate( $s['s_message'], 100 ); If there is html in the startup it is counted towards the length of the string. This means that the shortened text (visually) can be dramatically less than the required number of characters. What I think needs to happen is that the tags need to be stripped and the offset calculated without the html and then that offset translated into the formatted string. I know easy for me to say :tongue: You should never truncate raw HTML text. Really funny things happen when you end up with something like hello this is some text and here is a <a href='http://www.google.com'> Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.