CodeIgniter Forums

Full Version: Character_limiter with HTML
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

Hi guys,

I hope i have a simple question...

I'm using the text helper - character_limiter but i have a little problem. The text i have is html code. So i have bold and underline tags in my text. So I would like to know how i can limit my text without having unclosed tags...

Is that possible?



El Forum

The easy shot is to where you want to cut text cut it withouth html tags with strip_tags.

Then when you show it all where it make sense.

good luck.

El Forum

Mmm yes i know what you mean but it's kinda odd to show the text without bold and underline for 300 chars and if you click through you see the same text but WITH formatting. However... you may be right... it's not that important anyway. Thanks!

El Forum

I tend to want control over title or stripped text to make them css friendly all the time. So i mean you can make them be whatever fitting with the spot they are and control them.

Good luck !

El Forum

Word limiter with tag it's hard to cut.

for example. imagine if word like this "<font color="red"><i> 1 ..<u> 60 ... 70 </u> .. 100 </i></font>"
but you have to limiter with 65 character

after this paragraph will be in tag too
stip_tag should be great solution =)