Re: [SMARTY] google highlight
| From: | pete M | Date: | Mon, 18 Apr 2005 12:51:46 +0000 |
| Subject: | Re: [SMARTY] google highlight | ||
| References: | 1 2 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-12531@lists.php.net to get a copy of this message | ||
ok I've tried teh strtr() and it seems to work.. here's the modified code
foreach (array_unique($_terms) as $val) {
$trans[$val] = "<span class='google_highlight'>$val</span>";
}
return strtr($text, $trans);
however tis case sensitive ...
Is there a way around that ??
tia
pete
Messju Mohr wrote:
On Mon, Apr 18, 2005 at 12:59:55PM +0100, pete M wrote:I've got this "google highlight" modifier which was taken from the wiki http://smarty.incutio.com/?page=modifier.google_highlight ta toma@etree.org I've modified it slightly as per the link below http://www.pastebin.com/272747 The only problem is that "ocassionally" some of the phrases return spurious results.. eg - search for "win do" is ok <span class="google_highlight">Win</span>chester House.<span class="google_highlight">do</span>c however "pa ss" returns extra tags as CP<span cla<span class="google_highlight">ss</span>="google_highlight">Pa</span><span class="google_highlight">ss</span>e<span class="google_highlight">ss</span>mentsstr_replace() does replace already replaced parts. the 2-parameter-version of strtr() doesn't. greetings messjucan a guru shed some light on thisn tia Pete -- Smarty General Mailing List (http://smarty.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php