This topic is locked

How to Highlight search results

8/23/2006 2:20:45 PM
PHPRunner General questions
M
mmponline author

Is there some setting to have words highlighted (other colour, etc,) when a search result is returned.
Eg
Search lion will show results like this
The male normally walks...
[b][color=#FF0000]Lion
s are common in the lower part of...
I know someone out there will have a clever plan!

M
mmponline author 10/8/2006

Maybe there is still someone that has an answer to this. I see a lot of search engines, help files, etc. that use this feature.
Any suggestions?

Alexey admin 10/9/2006

Stephan,
PHPRunner has some support for search result highlighting however it's incomplete.

To enable it find this snippet in generated include\commonfunctions.php file:

/*

// highlight search results


and remove /** and the next /** signs.

T
thesofa 10/10/2006

Stephan,

PHPRunner has some support for search result highlighting however it's incomplete.

To enable it find this snippet in generated include\commonfunctions.php file:
and remove /** and the next /** signs.



Hi

Is there any way of doing this with V3.0?

J
Jane 10/10/2006

Hello,
there is no this feature in the PHPRunner 3.0.

You can do it to edit generated files manually.

T
thesofa 10/10/2006

Hello,

there is no this feature in the PHPRunner 3.0.

You can do it to edit generated files manually.



Pray tell me how?

J
Jane 10/10/2006

Theoretically you can copy corresponding code snippet from include/commonfunctions.php file (PHPRunner 3.1) and paste it to include/dbcommon.php file (PHPRunner 3.0) (no guarantee it works).

J
Jean 11/4/2006

Stephan,

PHPRunner has some support for search result highlighting however it's incomplete.

To enable it find this snippet in generated include\commonfunctions.php file:
and remove /** and the next /** signs.


Nothing happens (at all)... Could it be because of the choice of RichText ?
Perhaps (perhaps) could this help (found in http://www.expreg.com/lire-Chaines-source ) :

<?php

$ch='Les regex php, c\'est sympa, mais on trouve des

<a href="regex.php" title="les regex en php">Regex</a> aussi avec mysql.

Un exemple, en image <img src="test.gif" alt="une regex en image" />.';

function marque_mot($ch,$mot)

{

$tab=preg_split('`(<\w+.*?>)`',$ch,-1,PREG_SPLIT_DELIM_CAPTURE);

foreach($tab as $key=>$val){

if(preg_match('`^<\w+`',$val))

{

$tab[$key]=$val;

}

else

{

$tab[$key]=preg_replace('`\b'.$mot.'\b`i',

'<span style="background-color:#ffcc00">$0</span>',

$val);

}

}

return implode($tab);

}

$mot_a_trouver='regex';

echo marque_mot($ch,$mot_a_trouver);

?>
J
Jane 11/7/2006

Jean,
highlighting search result doesn't work for the fields in the HTML format (HTML format on the "View as" settings dialog on the Visual editor tab).

We plan to add this feature in one of the next PHPRunner update.