You are here: Re: [SMARTY] google highlight « Smarty Templates Posts « IT news, forums, messages
Re: [SMARTY] google highlight

Posted by pete M on 04/18/05 15:51

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>ments
>
>
> str_replace() does replace already replaced parts. the
> 2-parameter-version of strtr() doesn't.
>
> greetings
> messju
>
>
>>can 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

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация