convertString problem
Hey Jason
Am using this
<?php
function convertString($string) {
$retStr = $string;
$retStr = str_replace(array("<p>","</p>","<blockquote>","</blockquote>","<strong>","</strong>","<em>","</em>","<u>","</u>"," "), "", $retStr);
$retStr = preg_replace("/<a href=\"(.*)\">/i", " ", $retStr);
$retStr = preg_replace("/<img[^>]+\>/i", " ", $retStr);
return $retStr;
}
?>
combined with this
<?php echo substr(convertString($row_NewsPanelRS['NewsContent']),0,250)." ..."; ?>
But the problem is that if part of the content within the first 250 characters has got a link on it, then it removes all the content up to that <a> .. what am I doing wrong?
If you want to see it in action, you can see on this page As you can see from the main content, the first paragraph startes with 'After' but if you look at the Lateste News Article panel it startes with Motley which, as you can see in the main window, is a link.
Cheers
Jamie