Welcome Guest, Not a member yet? Register   Sign In
How can i trim text ?
#1

[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;

if (strlen($s) > $max_length)
{
    $offset = ($max_length - 3) - strlen($s);
    $s = substr($s, 0, strrpos($s, ' ', $offset)) . '...';
}


Messages In This Thread
How can i trim text ? - by El Forum - 06-28-2013, 01:02 PM
How can i trim text ? - by El Forum - 06-28-2013, 02:00 PM
How can i trim text ? - by El Forum - 06-28-2013, 02:01 PM
How can i trim text ? - by El Forum - 06-28-2013, 02:29 PM



Theme © iAndrew 2016 - Forum software by © MyBB