[ Index ]
 

Code source de Joomla 1.0.13

Accédez au Source d'autres logiciels libres

title

Body

[fermer]

/modules/ -> mod_search.php (source)

   1  <?php
   2  /**
   3  * @version $Id: mod_search.php 3114 2006-04-14 03:47:46Z stingrey $
   4  * @package Joomla
   5  * @copyright Copyright (C) 2005 Open Source Matters. All rights reserved.
   6  * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
   7  * Joomla! is free software. This version may have been modified pursuant
   8  * to the GNU General Public License, and as distributed it includes or
   9  * is derivative of works licensed under the GNU General Public License or
  10  * other free or open source software licenses.
  11  * See COPYRIGHT.php for copyright notices and details.
  12  */
  13  
  14  // no direct access
  15  defined( '_VALID_MOS' ) or die( 'Restricted access' );
  16  
  17  $button            = $params->get( 'button', '' );
  18  $button_pos        = $params->get( 'button_pos', 'left' );
  19  $button_text    = $params->get( 'button_text', _SEARCH_TITLE );
  20  $width             = intval( $params->get( 'width', 20 ) );
  21  $text             = $params->get( 'text', _SEARCH_BOX );
  22  $set_Itemid        = intval( $params->get( 'set_itemid', 0 ) );
  23  
  24  $output = '<input name="searchword" id="mod_search_searchword" maxlength="20" alt="search" class="inputbox'. $moduleclass_sfx .'" type="text" size="'. $width .'" value="'. $text .'"  onblur="if(this.value==\'\') this.value=\''. $text .'\';" onfocus="if(this.value==\''. $text .'\') this.value=\'\';" />';
  25  
  26  if ( $button ) {
  27      $button = '<input type="submit" value="'. $button_text .'" class="button'. $moduleclass_sfx .'"/>';
  28  }
  29  
  30  switch ( $button_pos ) {
  31      case 'top':
  32          $button = $button .'<br/>';
  33          $output = $button . $output;
  34          break;
  35  
  36      case 'bottom':
  37          $button =  '<br/>'. $button;
  38          $output = $output . $button;
  39          break;
  40  
  41      case 'right':
  42          $output = $output . $button;
  43          break;
  44  
  45      case 'left':
  46      default:
  47          $output = $button . $output;
  48          break;
  49  }
  50  
  51  // set Itemid id for links
  52  if ( $set_Itemid ) {
  53      // use param setting
  54      $_Itemid    = $set_Itemid;
  55      $link         = 'index.php?option=com_search&amp;Itemid='. $set_Itemid;
  56  } else {
  57      $query = "SELECT id"
  58      . "\n FROM #__menu"
  59      . "\n WHERE link = 'index.php?option=com_search'"
  60      . "\n AND published = 1"
  61      ;
  62      $database->setQuery( $query );
  63      $rows = $database->loadObjectList();
  64      
  65      // try to auto detect search component Itemid
  66      if ( count( $rows ) ) {
  67          $_Itemid    = $rows[0]->id;
  68          $link         = 'index.php?option=com_search&amp;Itemid='. $_Itemid;
  69      } else {
  70      // Assign no Itemid
  71          $_Itemid     = '';
  72          $link         = 'index.php?option=com_search';    
  73      }
  74  }
  75  ?>
  76  
  77  <form action="<?php echo $link; ?>" method="get">
  78      <div class="search<?php echo $moduleclass_sfx; ?>">
  79          <?php echo $output; ?>
  80      </div>
  81  
  82      <input type="hidden" name="option" value="com_search" />
  83      <input type="hidden" name="Itemid" value="<?php echo $_Itemid; ?>" />    
  84  </form>


Généré le : Wed Nov 21 14:43:32 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics