Hallo,
ich hätte eine Frage: Ist es möglich, bzw. wie ist es möglich, dass mein Searchbot nur eine bestimmte Section durchsucht? Genau geht es um die Section mit der id=18!
Ich hoffe ihr könnt mir helfen!
Hier mein Code:
Code:<?php defined( '_VALID_MOS' ) or die( 'Direct Access to this script is not allowed'); $_MAMBOTS->registerFunction( 'onSearch', 'botSearchTitles' ); function botSearchTitles( $text ) { global $database; $text = trim( $text ); if ( empty($text) ) { return array(); } $searchwords = explode(' ', $text); $data = array(); foreach( $searchwords as $word ) { $data[] = "\n con.title LIKE '%$word%' "; } $xwhere = ' WHERE ' . implode('AND', $data); $query = "SELECT con.title AS title," ."\n con.created AS created," ."\n u.title AS section," ."\n CONCAT( 'index.php?option=com_content&task=view&id=', con.id ) AS href," ."\n 2 AS browsernav" ."\n FROM #__content AS con" ."\n LEFT JOIN #__sections AS u ON u.id = con.sectionid" . $xwhere ."\n ORDER BY con.sectionid, con.title" ; $database->setQuery( $query ); // want sql error handling ? #if ($database->getErrorNum()) { # echo $database->stderr(); # exit(); #} return $database->loadObjectList(); } ?>


LinkBack URL
About LinkBacks
Zitieren
Lesezeichen