DGS Search v0.9.3 (08/27/00) - http://www.digitalgenesis.com

Description:

   Modules are nothing more than a php source file in the 'libs' directory containing
   a function of the same name. The module name is the name of the file, minus the
   ".php" extension.

   The module function must accept the variables: $retVal, $q, $r, $o, and $s.
   The module function must also return $retVal.

Variables:

   $retVal - Array value. This is the results used to build the Search Result page.
             The array takes the following form:

             array("link" => "", "url" => "", "description" => "", "fileSize" => 0, "lastMod" => "")

             NOTE: If "fileSize" or "lastMod" are left out of the array, they will not be
                   displayed on the Search Results page.

   $q      - String value. This is the submitted query.

   $r      - Integer value. This is the number of results to display per page.
             If this value is 0, then all results are displayed.

   $o      - Integer value. Offset into $retVal of the current results that will be displayed.

   $s      - Integer value. This cached size of the $retVal from a previous search.

Example: 

<?

/*
** DGS Search
** searchbody.php written by James M. Sella
** Search a body for loose items.
*/

function searchbody($retVal, $q, $r, $o, $s) {
   switch ($q) {
      case "pockets":
         $found = "Loose Change";
         $desc = "You found 3 gold and 1 silver.";
         break;
      case "hands":
         $found = "Ring";
         $desc = "You found a ring to rule them all.";
			break;
      case "shoes":
         $found = "Socks";
         $desc = "You found a smelly pair of socks.";
			break;
      default:
         $found = "Nothing";
         $desc = "You found nothing.";
   }
   $retVal[] = array("link" => $desc, "url" => "http://www.domain.com", "description" => $desc);
	return $retVal;
}

?>

Walk-Through:

   To create a module, do the following.

   0. Pick a module name.
      
      We will pick 'searchbody'.

   1. Open a new source file using your module name in the 'libs' directory.

		cd /path/to/dgssearch/libs
      vi searchbody.php

   2. Add a function that matches your module name and save.

      <?

      function searchbody($retVal, $q, $r, $o, $s) {
         /* Add one item. */
			$retVal[] = array("link" => "Loose Change", "url" => "http://www.domain.com", "description" => "You found 3 gold and 1 silver.");
         /* Return items. */
         return $retVal;
      }

      ?>

   3. Edit config.php in the 'config' directory and enable your module.

      cd /path/to/dgssearch/config
      vi config.php

      Locate the $config["modules"] line, and add your modules name..

      $config["modules"]  = array("searchfs", "searchbody");

   Thats it. You have created a simple module and enabled it. 
