Liebe Forengemeinschaft!
Ich benutze eine Komponente (Peoplebook) zur der es leider kein Suchen-Plugin gibt (herrkömliche Suchfunktion in Joomla). Nun habe ich angefangen und eins gebastelt. Sieht alles ganz nett aus, nur dass die Suchergebnisse nicht angezeigt werden.
Kann mir bitte jemand helfen (in der Datenbank gibt es keine Spalte mit "title" sondern eine mit "name" - nach der möchte ich suchen bzw die Suchresultate ausgeben).
Mein Code:
Vielen herzlichen Dank!Code:<?php defined( '_JEXEC' ) or die( 'Restricted access' ); $mainframe->registerEvent( 'onSearch', 'plgSearchPeoplebook' ); $mainframe->registerEvent( 'onSearchAreas', 'plgSearchPeoplebookAreas' ); JPlugin::loadLanguage( 'plg_search_peoplebook' ); if (!JComponentHelper::isEnabled('com_peoplebook', true)) { return JError::raiseError(JText::_('Peoplebook Error'), JText::_('Peoplebook is not installed on your system')); } function &plgSearchPeoplebookAreas() { static $areas = array( 'peoplebook' => 'Kader' ); return $areas; } function plgSearchpeoplebook( $text, $phrase = '', $ordering = '', $areas = null ) { $db = &JFactory::getDBO(); $user = &JFactory::getUser(); $menu = &JSite::getMenu(); if (is_array( $areas )) { if (!array_intersect( $areas, array_keys( plgSearchPeoplebookAreas() ) )) { return array(); } } // load plugin params info $plugin = &JPluginHelper::getPlugin('search', 'peoplebook'); $pluginParams = new JParameter( $plugin->params ); $limit = $pluginParams->def( 'search_limit', 50 ); $text = trim( $text ); if ($text == '') { return array(); } $section = JText::_( 'Kader'); $text = $db->Quote( '%'.$db->getEscaped( $text, true ).'%', false ); $rows = array(); $query = 'SELECT a.id, a.name AS title, ' . ' a.description AS text,' . ' CONCAT_WS( "/", a.name ) AS section,' . ' "2" AS browsernav' . ' FROM #__peoplebook AS a' . ' WHERE ( a.name LIKE '.$text . ' OR a.name LIKE '.$text . ' OR a.description LIKE '.$text.' )' . ' AND a.published = 1' . ' AND a.approved = 1' . ' AND a.access <= '.(int) $user->get( 'aid' ) . ' GROUP BY a.id' . ' ORDER BY '. $orderingCode; $db->setQuery( $query, 0, $limit ); $listCategories = $db->loadObjectList(); $limit -= count($listCategories); $results = array(); if(count($rows)) { foreach($rows as $row) { $results = array_merge($results, (array) $row); } } return $results; }
lG
Monika


LinkBack URL
About LinkBacks
Zitieren
Lesezeichen