Neeraj Kumar
2006-Jul-26 16:10 UTC
[Rails] How to highlight the search term in the search result
In the ''basecamp'' product from 37signals if I search for ''ruby'' the I get a bunch of results. In the search result page the search term (ruby in this case) is highlighted. I was wondering how to accomplish the same. How to highlight the ''search term'' in the search result? Is there any already existing utility that I could use? Thanks. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060726/2c9e5e0b/attachment-0001.html
Bharat Ahluwalia
2006-Jul-26 18:51 UTC
[Rails] RE: How to highlight the search term in the search result
From: "Neeraj Kumar" <neeraj.jsr@gmail.com>> Subject: [Rails] How to highlight the search term in the search result > To: rails@lists.rubyonrails.org > Message-ID: > <a60b4e990607260542s3ef7ad5el4cc19a5f7d01115c@mail.gmail.com> > Content-Type: text/plain; charset="iso-8859-1" > > In the ''basecamp'' product from 37signals if I search for > ''ruby'' the I get a > bunch of results. In the search result page the search term > (ruby in this > case) is highlighted. > > I was wondering how to accomplish the same. > > How to highlight the ''search term'' in the search result? Is there any > already existing utility that I could use? > > Thanks.Use the "highlight" command in the rhtml file Take a look at page #11 in the beta book at http://media.pragprog.com/titles/rails/Chapter18.pdf for an example. Bharat http://blog.publishedperspectives.com
Brittain
2006-Jul-26 22:32 UTC
[Rails] Re: How to highlight the search term in the search result
Neeraj Kumar <neeraj.jsr@...> writes:> > In the ''basecamp'' product from 37signals if I search for ''ruby'' the I get abunch of results. In the search result page the search term (ruby in this case) is highlighted.I was wondering how to accomplish the same.> How to highlight the ''search term'' in the search result? Is there any alreadyexisting utility that I could use?Thanks.> > _______________________________________________ > Rails mailing list > Rails@... > http://lists.rubyonrails.org/mailman/listinfo/rails >Search the API doc (ActionView) for the "highlight" method