Webboard: Problem with PHP-fontend and Searchword-highlighting
[email protected] 21 Apr 2005 16:59:06 -0000
| Newsgroups | gmane.comp.web.mnogosearch.php-frontend |
|---|---|
| Message-ID | <[email protected]> |
Author: Pete Email: [email protected] Message: > Hopefully I can revive this thread! All the previous messages are still in effect... I am using mnoGoSearch 3.2.20, with php-extension 1.96. > > I can't get those "boxes" to be replaced with my choice of HTML either. Here's what I've got so far: > > -------------------------------------------------------------- > $hlbeg = '<span style="background-color:#ddddcc;">'; > $hlend = '</span>'; > ... > udm_set_agent_param($mnoagent, UDM_PARAM_HLBEG, $hlbeg); > udm_set_agent_param($mnoagent, UDM_PARAM_HLEND, $hlbeg); From what it appears to me, the two parameters are only honored when using search.cgi. If you want to replace the "boxes" in your PHP script, do something like this: $hlbeg = '<strong>'; $hlend = '</strong>'; $title = highlight_text(udm_get_res_field($result, $index, UDM_FIELD_TITLE), $hlbeg, $hlend); $description = highlight_text(udm_get_res_field($result, $index, UDM_FIELD_DESC), $hlbeg, $hlend); $text = highlight_text(udm_get_res_field($result, $index, UDM_FIELD_TEXT), $hlbeg, $hlend); function highlight_text($text, $hlbeg, $hlend) { $text = str_replace("\2", $hlbeg, $text); $text = str_replace("\3", $hlend, $text); return $text; } Reply: <http://www.mnogosearch.org/board/message.php?id=15546>