Highlight Search Keywords

Started by Nathaniel, June 16, 2008, 03:32:22 PM

Previous topic - Next topic

Nathaniel

Link to Mod

Highlight Search Keywords 1.24 by Nathaniel

Formerly by Kalbenson.
Overview
This mod allows you to customize the colors that you use for your search highlighting within the smf system. Its a very simple mod but a useful one because it means that you can get rid of the monotone default yellow highlighting which comes with SMF.

You can find the settings for the Mod at this locations for both versions of SMF.
'Admin' Section -> 'Forum' Subsection -> 'Search' settings area -> 'Highlight Search Keywords' tab.

If you don't set any colors in the admin settings area then this mod will make no difference to your actual highlighting, because it will automatically highlight the keywords with the default SMF yellow (color code: 'FFFF00').

SMF Version Support
This mod is officially supported for SMF 2.0 final and above only. Below is a list of available versions of this mod and the previous versions of SMF that they supported. Use them at your own risk. The mod author will not be supporting or upgrading this mod in any way for versions of SMF below 2.0 final.

Version 1.23: SMF 1.1.x and versions of SMF 2 before SMF 2 RC3.
Version 1.24: SMF 2 RC3 and above.

Donate
If this mod has helped you, then feel free to support the developer by Donating. Any amount of money is welcome.

Version Changes
v1.24 - 27 May 2010
Changed package info to work with SMF 2 RC3.
Removed official support for SMF versions below SMF 2 RC2.
Updated the Search template edits for SMF 2 RC3.

v1.23 - 19 Novermber 2009
Updated for SMF 2 RC2 compatibility.

v1.22 - 18 August 2009
Updated mod for SMF 1.1.10 compatibility - Added a workaround for the SMF version bug.

v1.21 - 12 September 2008
Updated Mod for SMF 2 Beta 4.0 and SMF 1.1.6.

v1.2 - 14 June 2008
Upgraded Mod for SMF 2 Beta.
Fixed some minor bugs.
Added a settings area to chose colors.

v1.1 - 7th January 2008
Changed some comma concenators to dots
v1.0 - 4th January 2008
Initial Release
SMF Friend (Former Support Specialist) | SimplePortal Developer
My SMF Mods | SimplePortal

"Quis custodiet ipsos custodes?" - Who will Guard the Guards?

Please don't send me ANY support related PMs. I will just delete them.

Nathaniel

Version 1.21 - 12 September 2008
Updated Mod for SMF 2 Beta 4.0 and SMF 1.1.6.
SMF Friend (Former Support Specialist) | SimplePortal Developer
My SMF Mods | SimplePortal

"Quis custodiet ipsos custodes?" - Who will Guard the Guards?

Please don't send me ANY support related PMs. I will just delete them.

ElectricSquid

#2
I already have the mod installed, but I was trying to look into the code to see if I could modify how it highlights the search terms.
On my site, due to the colorings, using a highlighted box around the search word does not work well.
I would much rather highlight the text itself instead.

Nathaniel

Search for this code (Subs.php and Search.php):
<span style=\"background-color:".$color.";font-weight:bold;\">\$1</span>

Replace with this code:
<span style=\"color:".$color.";font-weight:bold;\">\$1</span>
SMF Friend (Former Support Specialist) | SimplePortal Developer
My SMF Mods | SimplePortal

"Quis custodiet ipsos custodes?" - Who will Guard the Guards?

Please don't send me ANY support related PMs. I will just delete them.

ElectricSquid

#4
That worked for when a user clicks the subject in the search results and goes to the topic. In the topic, the search words text are a different color.

But on the =search2 page (the search results), the highlight is still a box around the text.


EDIT OPPS :P
I must have not saves the edit in Search.php

THANK YOU!!
It works well and looks GREAT!!
Just what I was looking for.

ElectricSquid

#5
One of the things I added to my search2 page, is a header that shows what words the user has searched for.
I reused a part of the code found in the "did you mean" search form (in search.template.php) in order to get the searched words to show up.

Anyway, I would like to get the Highlight Search Keywords coding to highlight this heading, that way the user has a reference for what word is what color.

I have tried and tried for hours to get this mod to pick up on this simple header, but it has beaten me. I don't know how to do it and I could use your help, please.

Below is the code I hacked from the form to create this custom header I'm talking about
(use at your own risk everyone, even though it works, it is a total hack)


        <td class="metal_plate_top_center">

<span style="font-size: 70%;"><i>', $txt['you_searched_for'] ,':</i></span> ', $context['search_params']['search'], '

        </td>



... and for a peek at this code in action, click here [LINK] and search for something.
This code shows up on the next page (search2) at the top center of the second metal plaque.

Nathaniel

You should simply be able to call the 'highlighter' function, like in the code below.

       <td class="metal_plate_top_center">

<span style="font-size: 70%;"><i>', $txt['you_searched_for'] ,':</i></span> ', highlighter($context['search_params']['search']), '

        </td>
SMF Friend (Former Support Specialist) | SimplePortal Developer
My SMF Mods | SimplePortal

"Quis custodiet ipsos custodes?" - Who will Guard the Guards?

Please don't send me ANY support related PMs. I will just delete them.

ElectricSquid

I think I just learned something ;D

So what do I call that, when you put do the highlighter( ) thing?

Thanks a lot!!

ElectricSquid

That didn't work.
The text shows up, but there's no highlighting/color change.

R.Bourne

#9
I have 1.21 installed but I cannot either uninstall the previous version nor the new version can upgrade the old one!! Any suggestion?

Please disregard. I fixed it. Great update and thank you.

ElectricSquid

Quote from: ∑£ℓ¢†®¡¢ §ợų¡đ on September 15, 2009, 09:25:44 PM
That didn't work.
The text shows up, but there's no highlighting/color change.

Yea, disregard mine too.
I'm moving on to SMF 2.0, and with it, the theme I needed this added coding for will be redone.

Thanks for your help with making the text (font) color change instead of the highlight box around it.
It looks so much better that way, and I will be looking to use that tweak again when I get SMF 2.0 up and running.

:D I just checked to see if you coded for 2.0 too
Thanks, it looks like you are keeping up with the progression of SMF!!

Nathaniel

v1.23
Updated for SMF 2 RC2 compatibility.
SMF Friend (Former Support Specialist) | SimplePortal Developer
My SMF Mods | SimplePortal

"Quis custodiet ipsos custodes?" - Who will Guard the Guards?

Please don't send me ANY support related PMs. I will just delete them.

karanima

in forum Turkish "I" letter write a blank page when

Nathaniel

Quote from: karanima on January 01, 2010, 10:29:25 AM
in forum Turkish "I" letter write a blank page when

Could you please try to reword your post/explain your issue differently? I am not sure what you mean.
SMF Friend (Former Support Specialist) | SimplePortal Developer
My SMF Mods | SimplePortal

"Quis custodiet ipsos custodes?" - Who will Guard the Guards?

Please don't send me ANY support related PMs. I will just delete them.

karanima

search "ı"  letters white page
turkish forum

ı don't speak english sorry.thank google translate :)

rickmastfan67

Will this be updated to work with 1.1.11?  Thanks. :)

Eclipse16V

Nice Mod

Please update it for SMF 2.0RC3  ;)

Thanks
I worked with:
SMF 2 in German

Shop:
SID Giessen

Bruno36

Hello!

An update to SMF 2.0rc3 is provided?
Bruno36 the French
SMF 2.0.9

Nathaniel

v1.24 - 27 May 2010
Changed package info to work with SMF 2 RC3.
Removed official support for SMF versions below SMF 2 RC2.
Updated the Search template edits for SMF 2 RC3.
SMF Friend (Former Support Specialist) | SimplePortal Developer
My SMF Mods | SimplePortal

"Quis custodiet ipsos custodes?" - Who will Guard the Guards?

Please don't send me ANY support related PMs. I will just delete them.

lorth

works like a charm on 1.1.14  (v1.23 of the mod)

thanks for this really nice mod!  :)

Advertisement: