What's the easiest way to highlight the query words in search results? In title and description?
Aug 2, 2004, 9:46 AM
Veteran / Moderator (18436 posts)
Aug 2, 2004, 9:46 AM
Post #4 of 17
Views: 4133
Sounds like a pretty sool plugin. "Search Highlighter" (similar to the way GForum does it).
I'll add it to my list... but can't guarantee any time for a release :(
Cheers
Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
I'll add it to my list... but can't guarantee any time for a release :(
Cheers
Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Aug 3, 2004, 12:33 AM
Veteran / Moderator (18436 posts)
Aug 3, 2004, 12:33 AM
Post #8 of 17
Views: 4032
Quote:
It's not too hard is it?It is if your not a programmer. As I said in my last post; I'll try and get something made up... but I can't guarantee anything, as its a pretty busy time of year.
Cheers
Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Aug 3, 2004, 10:36 AM
Veteran / Moderator (18436 posts)
Aug 3, 2004, 10:36 AM
Post #10 of 17
Views: 4071
heheh.
I'm off for the night now. Just before I leave though, I'll post this URL;
Keyword_Highlighter: http://www.ultranerds.com/...bin/details/122.html
It should all work (I've tested it on a couple of my sites), and there is even documentation :)
Give it a go if you want.
Cheers
Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Aug 4, 2004, 12:26 AM
Veteran / Moderator (18436 posts)
Aug 4, 2004, 12:26 AM
Post #12 of 17
Views: 4023
No prob. If you want to hardcode the colors, you will need to edit /admin/Plugins/Keyword_Highlighter.pm
Find;
my @colors = map {
join "", map { sprintf "%02x", rand(255) } (0..2)
} (0..1);
...and replace with;
push @colors, 'FFFFFF';
push @colors, 'FF99FF';
push @colors, 'BBAA99';
Please note; you will need to change the colors to whatever color you want to use :)
Cheers
Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Find;
Code:
# define our random color. my @colors = map {
join "", map { sprintf "%02x", rand(255) } (0..2)
} (0..1);
...and replace with;
Code:
my @colors; push @colors, 'FFFFFF';
push @colors, 'FF99FF';
push @colors, 'BBAA99';
Please note; you will need to change the colors to whatever color you want to use :)
Cheers
Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Aug 5, 2004, 10:33 AM
Veteran / Moderator (18436 posts)
Aug 5, 2004, 10:33 AM
Post #14 of 17
Views: 3992
Hi. You need to just pass the other validables through the plugin. i.e;
change;
$Description
...to;
$Title
...or $VarName
$VarName can be the value of *ANY* tags thats available to you in the current template.
Hope that helps.
Cheers
Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
change;
$Description
...to;
$Title
...or $VarName
$VarName can be the value of *ANY* tags thats available to you in the current template.
Hope that helps.
Cheers
Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Sep 17, 2004, 10:04 PM
Enthusiast (648 posts)
Sep 17, 2004, 10:04 PM
Post #16 of 17
Views: 3948
Hi Andy I just tried these out :
# define our random color.
my @colors;
push @colors, 'FF66FF';
push @colors, '6699FF';
push @colors, '66FFFF';
push @colors, 'CC99FF';
push @colors, 'FFFF66';
push @colors, 'FF9933';
but it only displays "FF66FF" as a color for each word that is displayed in each description. Ie before modifying the code there was a different color for each link that was displayed description 1, color 1, / description 2, color 2 etc. whereas with this mod there is description 1, color 1 / description 2, color 1 etc.
Any ideas to get the other colors to pick up after the first one... ?
Thanks for the plug-in nice new function !
John
Significant Media
# define our random color.
my @colors;
push @colors, 'FF66FF';
push @colors, '6699FF';
push @colors, '66FFFF';
push @colors, 'CC99FF';
push @colors, 'FFFF66';
push @colors, 'FF9933';
but it only displays "FF66FF" as a color for each word that is displayed in each description. Ie before modifying the code there was a different color for each link that was displayed description 1, color 1, / description 2, color 2 etc. whereas with this mod there is description 1, color 1 / description 2, color 1 etc.
Any ideas to get the other colors to pick up after the first one... ?
Thanks for the plug-in nice new function !
John
Significant Media
Sep 18, 2004, 12:26 AM
Veteran / Moderator (18436 posts)
Sep 18, 2004, 12:26 AM
Post #17 of 17
Views: 3965
Hi. Sorry about that. Looks like you hit a bug =)
Changing the code inside the foreach () { } button to;
my @colors;
push @colors, 'FF66FF';
push @colors, '6699FF';
push @colors, '66FFFF';
push @colors, 'CC99FF';
push @colors, 'FFFF66';
push @colors, 'FF9933';
my $rand_number = rand $#colors;
# now lets make the pretty colours!
my $highlight_string = qq|style="background-color: #| . $colors[$rand_number] . q|"|;
my $replace = qq|<span $highlight_string>$_</span>|;
$value =~ s|\Q$_|$replace|ig;
...should make it so that multiple random colors are used :)
Cheers
Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Changing the code inside the foreach () { } button to;
Code:
# define our random color. my @colors;
push @colors, 'FF66FF';
push @colors, '6699FF';
push @colors, '66FFFF';
push @colors, 'CC99FF';
push @colors, 'FFFF66';
push @colors, 'FF9933';
my $rand_number = rand $#colors;
# now lets make the pretty colours!
my $highlight_string = qq|style="background-color: #| . $colors[$rand_number] . q|"|;
my $replace = qq|<span $highlight_string>$_</span>|;
$value =~ s|\Q$_|$replace|ig;
...should make it so that multiple random colors are used :)
Cheers
Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!