Simple Machines Community Forum

SMF Support => SMF 1.1.x Support => Aiheen aloitti: yogesh_gamer - toukokuu 28, 2011, 12:22:29 AP

Otsikko: highlight the search keyword
Kirjoitti: yogesh_gamer - toukokuu 28, 2011, 12:22:29 AP
how to highlight the search keyword
for example if i search the word "Prince" then it shouls highlight with color

Update:
i tried this mod:
http://custom.simplemachines.org/mods/index.php?mod=1259
but it change the background of that word.
i want to change the color of search keyword and makes it bold
Otsikko: Re: highlight the search keyword
Kirjoitti: yogesh_gamer - toukokuu 28, 2011, 10:32:37 IP
please reply me
its second day without any reply
Otsikko: Re: highlight the search keyword
Kirjoitti: Dzonny - toukokuu 29, 2011, 08:54:11 AP
Hello there.

You didnt specify what version of smf are you using?
I belive that you can manage what you need with mod that you tried with a bit of changes in Sources/Search.php, but the best would be to ask in mods support topic about that:
http://www.simplemachines.org/community/index.php?topic=244847.0

Regards.
Otsikko: Re: highlight the search keyword
Kirjoitti: Sir Osis of Liver - toukokuu 29, 2011, 03:05:28 IP

Hey, yogesh.  Not sure what you're asking.  Do you want to highlight the keyword in the Search input field?

Otsikko: Re: highlight the search keyword
Kirjoitti: yogesh_gamer - toukokuu 29, 2011, 10:40:47 IP
I am using 1.1.13 version.
I want to change the color of search keyword and make it bold.
Otsikko: Re: highlight the search keyword
Kirjoitti: Sir Osis of Liver - toukokuu 29, 2011, 10:52:12 IP

In index.template.php -

Find this:



<input type="text" name="search" value="" style="width: 190px;" />&nbsp;




Change it to this:



<input type="text" name="search" value="" style="width: 190px; color:red; font-weight:bold;" />&nbsp;

Otsikko: Re: highlight the search keyword
Kirjoitti: yogesh_gamer - toukokuu 30, 2011, 04:17:26 AP
nothing happened

update:
hey its change the color of the word which we want to search

I want to change the color of search keyword in  the post.
I am poor in english.

update:
Just like this website. search "search" on this topic.
you will get what i wanted to say
Otsikko: Re: highlight the search keyword
Kirjoitti: Sir Osis of Liver - toukokuu 30, 2011, 02:01:49 IP

OK, I understand what you want.  It appears to be a standard feature of 2.0, but not 1.1.13.  Not a simple edit.  I may be able to modify the code of the mod you tried in your first post.  I'll have a look soon as I get some time.

Otsikko: Re: highlight the search keyword
Kirjoitti: Sir Osis of Liver - toukokuu 30, 2011, 09:02:22 IP
Didn't try this (don't like to install mods), but looks simple enough.

Reinstall the Highlight Search Keywords mod.

In /Sources/Subs.php -

Find this:



// Do the Highlight
$message = preg_replace('/((<[^>]*)|' . preg_quote(strtr($word, array('\'' => ''')), '/') . ')/ie' . ($context['utf8'] ? 'u' : ''), "'\$2' == '\$1' ? stripslashes('\$1') : '<span style=\"background-color:".$color.";font-weight:bold;\">\$1</span>'", $message);




Change it to this:



// Do the Highlight
$message = preg_replace('/((<[^>]*)|' . preg_quote(strtr($word, array('\'' => ''')), '/') . ')/ie' . ($context['utf8'] ? 'u' : ''), "'\$2' == '\$1' ? stripslashes('\$1') : '<span style=\"color:".$color.";font-weight:bold;\">\$1</span>'", $message);



It should change the font color instead of the background, and make it bold, and create an admin option to set the color.

Let me know if it works.

Otsikko: Re: highlight the search keyword
Kirjoitti: yogesh_gamer - toukokuu 31, 2011, 09:56:12 AP
ok. i didn't find the text which is to be replaced
please help me
Otsikko: Re: highlight the search keyword
Kirjoitti: Sir Osis of Liver - toukokuu 31, 2011, 02:41:41 IP

You have to reinstall the mod first - the // Do the Highlight code is added to Subs.php by the mod, it's not in the original file.

Otsikko: Re: highlight the search keyword
Kirjoitti: yogesh_gamer - toukokuu 31, 2011, 09:46:06 IP
In actual i tried the mod on my another website (just for testing)
On my website when i apply the mod:
http://custom.simplemachines.org/mods/index.php?mod=1259

HighlightSearchKeywords_v1.23.tar.gz

i am getting this error (look 4th point)
nstalling this package will perform the following actions:
Type Action Description
1. Execute Modification ./Sources/Display.php Test successful
2. Execute Modification ./Sources/Subs.php Test successful
3. Execute Modification ./Sources/Search.php Test successful
4. Execute Modification ./Themes/default/Search.template.php [color=red]Test failed[/color]
5. Execute Modification ./Sources/ManageSearch.php Test successful
6. Execute Modification ./Themes/default/languages/Modifications.english.php Test successful
7. Execute Modification ./Themes/default/languages/Modifications.english-utf8.php Test successful



and when i tried

HightlightSearchKeywords_1.24.tar.gz

i am getting this error
LainaaThe package you tried to upload either is not a valid package or has become corrupted.

please reply me
Otsikko: Re: highlight the search keyword
Kirjoitti: Sir Osis of Liver - toukokuu 31, 2011, 10:08:52 IP

Thought you had installed that mod successfully.  Make sure it's uninstalled, and we'll try Plan B.

In style.css -

Find this:



/* Highlighted text - such as search results. */
.highlight
{
background-color: yellow;
font-weight: bold;
color: black;
}




Change it to this:



/* Highlighted text - such as search results. */
.highlight
{
font-weight: bold;
color: red;
}


Otsikko: Re: highlight the search keyword
Kirjoitti: yogesh_gamer - kesäkuu 01, 2011, 01:31:43 AP
when i search a keyword.
its not showing effect.
in fact it just open the topic page simply.
without any search.
please register on my website and see.
website: www.downloadyourworld.com
Otsikko: Re: highlight the search keyword
Kirjoitti: Sir Osis of Liver - kesäkuu 01, 2011, 02:47:38 IP

Just took a quick look at your site - no idea what it's doing.  The style.css edit works fine on my 1.1.13 install.  Did you uninstall the Highlight mod?  Any other mods installed?  What changes have you made to Search?

Otsikko: Re: highlight the search keyword
Kirjoitti: yogesh_gamer - kesäkuu 01, 2011, 09:55:12 IP
ok. take a look at this topic.
http://www.simplemachines.org/community/index.php?topic=433929.msg3043408#msg3043408
I changes the search by this.
Otsikko: Re: highlight the search keyword
Kirjoitti: Sir Osis of Liver - kesäkuu 01, 2011, 10:55:14 IP
IIRC, you wanted Search to just display the topic, and that's what it's doing.  Can you attach your Search.template.php?

1.1.13 Search does not highlight anything in the topic subject line, only in the post description and post text, which you've eliminated with the earlier mod.  If you do some searches on your forum, you'll see that the search term is not always in the subject line, but rather in the post, which you're not showing, so there's nothing to highlight.  Can't have it both ways.

Otsikko: Re: highlight the search keyword
Kirjoitti: Sir Osis of Liver - kesäkuu 01, 2011, 11:18:37 IP

Here, look at this -

(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fwww.thekrashsite.com%2Fpics%2Fsearchss1.jpg&hash=0ddd1cd4896ab5167a0c712d10ab3e6f9d625612)

The previous mod eliminated the two lines with highlighted text, which are the post title and the post itself.  The topic subject line (circled in red) is not highlighted, and in many searches will not contain the keywords, so there's nothing to highlight.  Try searching 'Games' on your forum - you'll get a lot of topics that don't contain 'Games' in the subject, because Search found it in the posts, which are not displayed.

Otsikko: Re: highlight the search keyword
Kirjoitti: yogesh_gamer - kesäkuu 01, 2011, 11:51:12 IP
I want to remove the screenshots from search page.
But when member open search result topic the search keyword should be red and bold.
just like vbulletin.
Otsikko: Re: highlight the search keyword
Kirjoitti: Sir Osis of Liver - kesäkuu 02, 2011, 12:17:40 AP

Haven't been on a vB board for a while, and don't remember how their search works.  One of the coding boards I sometimes visit highlights all the matching keywords in the entire thread - it's hugely annoying. 

This may do what you want -

http://www.simplemachines.org/community/index.php?topic=215214.0;all

Looks like you should reinstall the original 1.1.13 Search.template.php before you try installing the mod.

Otsikko: Re: highlight the search keyword
Kirjoitti: yogesh_gamer - kesäkuu 02, 2011, 01:08:55 AP
please see the attachment and thats i want
Otsikko: Re: highlight the search keyword
Kirjoitti: Sir Osis of Liver - kesäkuu 02, 2011, 02:54:15 IP

You've lost me on this one.  Where is that screenshot from?

Otsikko: Re: highlight the search keyword
Kirjoitti: yogesh_gamer - kesäkuu 03, 2011, 09:08:53 AP
I need another SMF member to solve the problem. please somebody solve my problem
Otsikko: Re: highlight the search keyword
Kirjoitti: yogesh_gamer - kesäkuu 04, 2011, 07:48:28 AP
please reply me. i want the same search cusomisation
Otsikko: Re: highlight the search keyword
Kirjoitti: yogesh_gamer - kesäkuu 11, 2011, 11:54:59 AP
is there no solution?