Skip a word

3 posts by 2 authors in: Forums > CMS Builder
Last Post: April 10, 2013   (RSS)

By Djulia - April 10, 2013 - edited: April 10, 2013

Hi,

An example here:

$str = maxWords($record['title'], 10);
$newTitle = explode(" ", trim($str), 2);

$str1 = '<b style="color:red">' . $newTitle[0] . '</b>';

if (isset($newTitle[1])) { $str2 = '<i>' . $newTitle[1] . '</i>'; }
else { $str2 = ''; }

$newTitle = $str1 . $str2;
echo $newTitle;

Hope that helps!

Djulia

By Kenny - April 10, 2013

Absolutely spot on!  Worked great - thanks!