PDA

View Full Version : [Highlight Search Terms] Mod


VSDan
09-28-2005, 06:04 AM
The following mod will highlight terms in the search results page. As easy as 1-2-3:

Step 1
Open templates/link.tpl:

Find:

Content visible to registered users only.

Add the following before:

Content visible to registered users only.

Step 2
Find:

Content visible to registered users only.

Replace with:

Content visible to registered users only.

Step 3
Find:

Content visible to registered users only.

Replace with:

Content visible to registered users only.

[UPDATE:] change 'term' to 'search' in first code block to use this mod for phpLD 3.04+


Cheers,

Dan
Virtual Solutions
monster-submit.com

Sharr76
09-28-2005, 07:21 PM
Can we see this working? :D

VSDan
09-28-2005, 07:24 PM
Sure can: go to the following URL, and enter webmaster as search term:

http://www.monster-submit.com/directory/


Cheers,

Dan
Virtual Solutions
monster-submit.com

Neticus
12-09-2005, 11:10 PM
Thanks for a great mod everything works as instructed. Yet I seem to be having the problem of words being over-highlighted.
For instance a search for 'hosting' finds 'Linux hosting' - hosting will be highlighted but the space before it will also be highlighted along with the word. This over-highlighting poses problems as the process dosen't seem to recognise 'hosting' if 'linuxhosting' is placed together as one word.

I don't understand maybe its me any help much appreciated, thanks
Neticus

VSDan
12-09-2005, 11:41 PM
Hi Neticus:

I don't have that problem myself. Can you provide URL to your directory so I can check.

Neticus
12-10-2005, 01:38 AM
Hi VSDan, have figured it out as suspected it was a problem from my side. Sorry my bad!

What it was was I had removed 'Search Results for: ' in the following code in index.php, Yet had also left a space inbetween the commas when I did so, thus ' ' when it should have been '' . That space was also being processed as part of the search hence the over-highlighting effect.

Content visible to registered users only.

Although I have also now discovered that the highlight dosen't work even when the full 'Search Results for: ' text is in place. For me the highlight only works when that field is blank and left as '' I don't know why, its like the highlight code is taking the text in DESCRIPTION field as part of the search.

So thats the downlow!

Again thanks for the reply.
Cheers Neticus.

angeljs
12-31-2005, 02:02 PM
I can't seem to get this working...I've added the code as supplied, but the search terms won't highlight
:(

angeljs
01-13-2006, 06:35 PM
Any idea what the problem could be? :?:

VSDan
01-13-2006, 07:57 PM
Is this where it is being used:

/php/

Can you post your link.tpl.

angeljs
01-13-2006, 08:48 PM
Sure, thanks:

Content visible to registered users only.
Yes, the site below is where I have it.

VSDan
01-13-2006, 09:31 PM
This could take some debugging. Can you send me your FTP access information? If so, then you can send c/o support at monster-submit dot com

m_leefs
01-23-2006, 06:00 AM
Along with angeljs I also added the code as supplied, but the search terms won't highlight. I also just installed phpLD and everything else seems to work great. I tried to do some debugging, but as a newby without too much php experience I'm trying my best. I did find that the following

Content visible to registered users only.

contains "Search results for: term" so the code given will only highlight text that contains the following:

Search results for: term

But will not highlight just "term". The search though pulls out all links with "term" in them. So in a list I have the following highlights:

This is a link with the word term, which won't highlight, but Search results for: term will highlight. Weird huh.

Any help would be great. Thanks!

VSDan
01-23-2006, 06:21 AM
Can you post your index.php and main.tpl files.

VSDan
01-25-2006, 08:23 PM
I think I see the problem (should have mentioned in my instructions). In index.php, change:

Content visible to registered users only.

to:

Content visible to registered users only.

m_leefs
01-26-2006, 05:53 AM
Thanks VSDan for the fix! I also added some extras in order to highlight multiple word searches (seperated by spaces).

replace
Content visible to registered users only.

with
Content visible to registered users only.

Doing this I noticed a bug in the search function when searching multiple words. The search is dependent on the order of the words, however when searching multiple words one may not want that. Example: Searching "great site" will find links like "This is a great site", but not "This site is great". Any insight anybody could give would be great. Thanks.

John D
02-06-2006, 07:39 PM
Hey,
This doesn't seem to highlight it for me..

Try a search on All Dot Net - Don't see any differences.

Thanks :)

Neticus
02-06-2006, 09:14 PM
Have you tried this yet?:
http://www.phplinkdirectory.com/forum/viewtopic.php?p=9284#9284

John D
02-06-2006, 09:22 PM
Thanks a lot :)

There were that many replies with different fixes I read it a few times but still missed a lot ;)

LyndaLAX
03-23-2006, 05:49 AM
thanks,
Lynda

angeljs
07-30-2006, 01:27 PM
Oh, dear, now something else has happened.

VSDan
07-30-2006, 07:43 PM
I cannot believe no one, including myself, spotted this - although we obviously made the change when we implemented. Change all incidences of [/b] to </b>.

angeljs
07-31-2006, 08:56 AM
That's definately better, thanks. :) I'm pleased to have finally got this working. Great mod!

arale
09-26-2006, 04:45 PM
I have problem. I add script below to link.tpl
Content visible to registered users only.
when search, its show result like this:
<b style='background-color: red; color: #FFFFFF;'>test</b>

How to fix? I want use css, class="...", how to do it?

VSDan
09-26-2006, 07:27 PM
<b style='background-color: red; color: #FFFFFF;'>test</b> is CSS. You can change (there are two) to:

<b class="somestyle">test</b>

arale
09-27-2006, 04:35 AM
not working! I change to
Content visible to registered users only.

when run. get error:
Parse error: parse error, unexpected T_STRING in htdocs\phpLD\temp\templates\en^%%58^587^587A07D9%% link.tpl.php on line 10

its version 3.0.6. Please help...

VSDan
09-27-2006, 05:14 AM
Content visible to registered users only.
[/LEFT]

arale
09-27-2006, 05:20 AM
its not work with me :(
I always get result <b class='highlight'>test</b> on result page

VSDan
09-27-2006, 05:53 AM
Sorry, but I do not follow. Regardless of search term entered, only 'test' is highlighted?

arale
09-27-2006, 09:57 AM
its not highlight, just show result like this picture:

Content visible to registered users only.

I want its bold only

VSDan
09-27-2006, 04:48 PM
Hi:

Can you post your link.tpl template file.

arale
09-28-2006, 02:54 AM
This is it:
Content visible to registered users only.

VSDan
09-28-2006, 03:37 AM
Hi:

1. Change:

{$title_highlighted|escape}

to:

{$title_highlighted}

2. Change:

{$desc_highlighted|escape}

to:

{$desc_highlighted}

arale
09-28-2006, 01:53 PM
yah, its work for normal links only. Featured links not show this effect :S

VSDan
09-28-2006, 08:11 PM
Content visible to registered users only.

Do you have a separate template file for featured links (e.g., featured_link.tpl)? If so, then you must do same thing in that template file as well.

shadav
12-23-2006, 05:08 PM
i can't get it to work here's what's in my link.tpl search works, but no highlights Content visible to registered users only.

VSDan
12-23-2006, 08:40 PM
Content visible to registered users only.

Try revised code here:

http://www.phplinkdirectory.com/forum/showpost.php?p=4480&postcount=1

shadav
12-25-2006, 03:27 AM
still not working i even reinstalled a new link.tpl file and inserted the code...could it because i'm using the phpLD2 version?

genious
12-25-2007, 10:06 PM
Content visible to registered users only.


the keyword for search carrying the seach value is "q" not term for v2.xx.

its working on 3.xx version,
i guess need more time to figure out for 2.xxx

cheers,

Trapatoni
02-22-2008, 07:29 PM
I noticed that if you search for term "james bond" (with lowercase), the highlighted words in the search results are shown with lowercase first letters. And if you search for "James Bond" then the highlighted words are shown with capital first letters. Any idea how to avoid this, so that when you search for a term, the highlighted words from the results will stay with their original capitalization?

mgrohan
03-22-2008, 09:16 AM
Content visible to registered users only.

Any success on getting a highlighted search term mod working in 2.xxx. Had a try but no success.