26
Thanks to psindia for his solution ( sent by email ), I include it with my code:
$tags = array('/<?((?!?>).)*?>/s');
$imgtag = '';
if($options[8] ==1) { $imgtag = "<img>"; } // hide/show article images
$cleantext = strip_tags(preg_replace($tags, '', $news['text']), '<div><span><br>'.$imgtag.'<a><p>'); // cleaning XHTML in news
$normal_text=$myts->displayTarea($cleantext, 1, 1, 1, 1, 1); // added by Vinod
$news['text'] = news_truncate_tagsafe($normal_text, $letters + 100);
Now what is the reverse function of
strip_tags ? I mean how to remove all except img tag ?