![]() |
How can i trim text ? - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: How can i trim text ? (/showthread.php?tid=58603) |
How can i trim text ? - El Forum - 06-28-2013 [eluser]margsot[/eluser] I would like to trim text of one field called description to 100 characters. I tried to use this php code in my view file but doesnt work. Code: $max_length = 100; How can i trim text ? - El Forum - 06-28-2013 [eluser]Syllean[/eluser] The code works fine for me, are you sure that you passed $s into your view correctly? You really shouldn't be dealing with this type of logic in your views anyway, it's better to process it in your controller. How can i trim text ? - El Forum - 06-28-2013 [eluser]anis2505[/eluser] Take a look at the Text helper http://ellislab.com/codeigniter/user-guide/helpers/text_helper.html How can i trim text ? - El Forum - 06-28-2013 [eluser]margsot[/eluser] Thanks for your help. Now works fine |