This mod is no longer supported. Live Search in the current K2 svn works great.

This is a modification of the Live Search functionality found in K2 from svn and the nightly builds. I’m currently using this mod with my site. For a demonstration, just type something in the search field. This mod will not work in K2 Beta Two r167. If Live Search and/or Rolling Archives currently do not work with your site, then this mod most likely will not work.

Features:

  1. Search results shown in the sidebar.
  2. Works without the need of the built-in Rolling Archives. Yay!
  1. Button to clear the search results.

Installation Instructions:

  1. Make a backup of the following files:
    • livesearch.php
    • searchform.php
    • js/livesearch.js.php
  2. Download live-search-1.0.zip.
  3. Copy livesearch.php and searchform.php into the k2 folder, replacing the existing files.
  4. Copy livesearch.js.php into the js subfolder, replacing the existing file.
  5. Copy search-more.gif and search-reset.gif into your scheme’s images folder.
  1. Add the following to your scheme’s stylesheet:

  1. /* Live Search */
  2. #live-results {
  3.     padding: 10px;
  4. }
  5. #live-results h2 {
  6.     display: block;
  7.     font-weight: bold;
  8. }
  9. #live-results h3 {
  10.     font-weight: normal;
  11. }
  12. #live-results h3 a:hover {
  13.     color: #27d;
  14. }
  15. #live-results .chronodata {
  16.     display: block;
  17.     margin-bottom: 0.5em;
  18.     color: #666;
  19. }
  20. #live-results .more-results {
  21.     display: block;
  22.     font-weight: bold;
  23.     margin: 1em 15px 0px 0px;
  24.     padding: 2px 0px 2px 20px ;
  25.     background: url('images/search-more.gif') left center no-repeat;
  26. }
  27. #searchinput, #searchinput.livesearch {
  28.     width: 150px;
  29. }
  30. #search-loading {
  31.     float: right;
  32.     height: 18px;
  33.     width: 18px;
  34.     background: url('../../images/spinner.gif') center center no-repeat;
  35. }
  36. #search-reset {
  37.     margin-left: 10px;
  38.     height: 18px;
  39.     width: 16px;
  40.     background: url('images/search-reset.gif') center center no-repeat;
  41.     cursor: pointer;
  42. }
  43. /* Sidebar RSS icon fix */
  44. .feedlink img {
  45.     float: right;
  46.     position: static;
  47. }

Download: live-search-css.txt

Notes:

If you’re applying the stylesheet additions directly to the default style.css then change the background tag for #search-loading to: background: url('images/spinner.gif') center center no-repeat;