Strip escaped html
Posted: Wed Oct 18, 2006 2:28 pm
I have the following code which I need to amend to strip out escaped html, which currently sits nested between "!!<<" and ">>!!" tags (no inverted commas!) . Can someone please advise how I can change the following code to do this and still have it output the correct number of characters and ensure it does not end with "&#" should "•" overshoot the 95 characters:-
Cheers
Code: Select all
<actinic:block php="true">
$sShort = "";
$sOriginal = "<actinic:variable encoding="html" name="ProductDescription" selectable="false" />";
if (strlen($sOriginal)>95)
{
$sShort = substr($sOriginal,0,95) . "...";
}
else
{
$sShort = $sOriginal;
}
$old = '•';
$new = '•';
$exp = '/' . $old . '/';
$sShort = preg_replace($exp, $new, $sShort);
echo $sShort;
</actinic:block>