Mambot Поиска для Joomla 1.0.X
15.11.2009
Написание поискового мамбота для Joomla 1.0.X.
Для начала пример написания мамбота поиска:
1 |
<?php defined( '_VALID_MOS' ) or die( 'Доступ запрещен' ); $_MAMBOTS->registerFunction( 'onSearch', 'botSOMenuSRCH' ); function botSOMenuSRCH( $text, $phrase='', $ordering='' ) { global $database; $myItemid = '16'; $sComName = 'com_somenu'; $sTable = 'real_somenu_category'; $botParams = new mosParameters( $mambot->params ); $limit = $botParams->def( 'search_limit', 50 ); $text = trim( $text ); if ( $text == '' ) { return array(); } $sQuery1 = 'SELECT a.title AS title,' . "\n". ' a.title AS text,' . "\n". ' "" AS created,' . "\n". ' "" AS browsernav,' . "\n". ' "" AS section,' . "\n". ' CONCAT("index.php?option='.$sComName.'&Itemid='.$myItemid.'#", a.id) AS href' . "\n". ' FROM '.$sTable.' AS a' . "\n". " WHERE ( a.title LIKE '%$text%'" // . "\n". " OR a.text LIKE '%$text%'" . "\n". ' )' // . "\n". ' AND a.publish = 1' ; $database->setQuery( $sQuery1, 0, $limit ); // $database->setQuery( $query1 .' UNION '. $query2, 0, $limit ); $rows = $database->loadObjectList(); return $rows; } ?> |