Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Jeroen Breuer 4861 posts 12138 karma points MVP 3x admin c-trib
    Jun 11, 2010 @ 12:10
    Jeroen Breuer
    0

    Search with highlight

    Hello,

    I'm building a website which needs a search option. I think I'm going to use XSLT search for this, but that's not my question. When the search result page is visited the search result should be highlighted on that page. I've never done this before and I don't know how I should to do. Can I pass the search result with a querystring and use javascript to highlight the words or do I need to do it with XSLT? Any suggestions?

    Jeroen

  • Matt Brailsford 2958 posts 15629 karma points MVP 7x c-trib
    Jun 11, 2010 @ 12:17
    Matt Brailsford
    2

    Id probably go the Querystring and javascript route myself, as it's not really that important that it needs to be built in, and it would require you to modify all your ouputs if you did.

    Maybe take a look at this jQuery plugin:

    http://johannburkard.de/blog/programming/javascript/highlight-javascript-text-higlighting-jquery-plugin.html

    Matt

  • Lee Kelleher 3945 posts 15163 karma points MVP 10x admin c-trib
    Jun 11, 2010 @ 12:18
    Lee Kelleher
    0

    Hi Jeroen,

    You could use JavaScript on the page to highlight the keywords from the search results page. Few examples...

    http://www.iamcal.com/publish/articles/hacks/google_highlighter/

    http://www.kryogenix.org/code/browser/searchhi/

    These are based on the "document.referrer" querystring ... so make sure that they are available (as opposed to using POST to pass the query).

    Cheers, Lee.

  • Jeroen Breuer 4861 posts 12138 karma points MVP 3x admin c-trib
    Jun 11, 2010 @ 12:21
    Jeroen Breuer
    0

    Thanks for the feedback. I'll have a look at it :).

    Jeroen

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies