print substring but show full words not cutted character..!! |
[eluser]Zeeshan Rasool[/eluser]
Hi all, I need little help from you.I want to print content of post but limited portion and after that i show a link "Read More" in end so that it leads to full post detail. But when i use substr() func and use 200 character it prints well but i need to print or need to end substring with full word example: Default: This is my post and when it mak...ReadMore I need: This is my post and when it makes...ReadMore One idea is to use array to store word by word but any idea from you guys! thanks in advance:
[eluser]Colin Williams[/eluser]
Do your substr, then loop backward, trimming until you reach a word breaking character.
[eluser]Dam1an[/eluser]
You could always use thge character_limiter function in the text helper
[eluser]Zeeshan Rasool[/eluser]
Thanks guys ! character_limiter() func is really workig well. |
Welcome Guest, Not a member yet? Register Sign In |