AJAX
[ class tree: AJAX ] [ index: AJAX ] [ all elements ]

Source for file livesearch.class.php

Documentation is available at livesearch.class.php

  1. <?php
  2. /**
  3.  * Simple test class for doing fake livesearch
  4.  *
  5.  * @category   HTML
  6.  * @package    AJAX
  7.  * @author     Joshua Eichorn <josh@bluga.net>
  8.  * @copyright  2005 Joshua Eichorn
  9.  * @license    http://www.opensource.org/licenses/lgpl-license.php  LGPL
  10.  * @version    Release: 0.4.1
  11.  * @link       http://pear.php.net/package/HTML_AJAX
  12.  */
  13.  // $Id$
  14. class livesearch {
  15.     /**
  16.      * Items to search against
  17.      */
  18.     var $livesearch = array(
  19.         1 => 'Orange',
  20.         2 => 'Apple',
  21.         3 => 'Pear',
  22.         4 => 'Banana',
  23.         5 => 'Blueberry',
  24.         );
  25.     var $livesearch2 = array(
  26.         1 => 'Orange-2',
  27.         2 => 'Apple-2',
  28.         3 => 'Pear-2',
  29.         4 => 'Banana-2',
  30.         5 => 'Blueberry-2',
  31.         );
  32.     /**
  33.      * Perform a search
  34.      *
  35.      * @return array 
  36.      */
  37.     function search($input{
  38.         $ret = array();
  39.         foreach($this->livesearch as $key => $value{
  40.             if (stristr($value,$input)) {
  41.                 $ret[$key$value;
  42.             }
  43.         }
  44.         return $ret;
  45.     }
  46.  
  47.     function search2($input{
  48.         $ret = array();
  49.         foreach($this->livesearch2 as $key => $value{
  50.             if (stristr($value,$input)) {
  51.                 $ret[$key$value;
  52.             }
  53.         }
  54.         return $ret;
  55.     }
  56. }
  57. ?>

Documentation generated on Mon, 11 Mar 2019 15:48:25 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.