Hallo ich benutze,
Joomla 1.5.14 und die Komponente Image Weblinks (www.australien-suche.de)
Ich möchte mir ein Plugin basteln, damit die Image Weblinks auch in der Joomla-Suche angezeigt werden.
Ich bin jetzt soweit, dass die Ergebnisse richtig angezeigt werden. Klickt man jedoch auf einen Link, gelangt man zu einer leeren Seite.
So sieht mein Script aus:
<?php
defined('_JEXEC')
or die( 'Restricted access' );
$mainframe->registerEvent('onSearch',
'plgSearchImgWeblinks');
$mainframe->registerEvent('onSearchAreas',
'plgSearchImgWeblinksAreas');
function &plgSearchImgWeblinksAreas() {
static $areas = array('imgWeblinks' => 'ImgWeblinks');
return $areas;
}
function plgSearchImgWeblinks( $text, $phrase='',
$ordering='', $areas=null ){
$db =& JFactory::getDBO();
$user =& JFactory::getUser();
if (is_array( $areas )) {
if (!array_intersect( $areas,
array_keys( plgSearchImgWeblinksAreas() ) )) {
return
array();
}
}
$plugin =& JPluginHelper::getPlugin('search', 'ImgWeblinks');
$pluginParams = new JParameter( $plugin->params );
$limit = $pluginParams->def( 'search_limit', 50 );
$text = trim( $text );
if ($text == '') {
return array();
}
$section = JText::_( 'ImgWeblinks' );
$wheres = array();
switch ($phrase){
case 'exact':
$text = $db->getEscaped($text);
$wheres2 = array();
$wheres2[]= "LOWER(a.title)
LIKE '%$text%'";
$wheres2[]= "LOWER(a.description)
LIKE '%$text%'";
$where = '(' . implode( ')
OR (', $wheres2 ) . ')';
break;
case 'all':
case 'any':
default:
$words = explode( ' ', $text );
$wheres = array();
foreach ($words as $word) {
$word = $db->getEscaped($word);
$wheres2 = array();
$wheres2[] = "LOWER(a.title)
LIKE '%$word%'";
$wheres2[] = "LOWER(a.description)
LIKE '%$word%'";
$wheres[] = implode( ' OR ', $wheres2 );
}
$where= '('.implode(($phrase == 'all'
? ') AND ('
: ') OR ('), $wheres ) . ')';
break;
}
switch ( $ordering ) {
default:
$order = 'a.title ASC';
break;
}
$query = "SELECT * FROM #__imgweblinks AS a"
."\n WHERE ( $where )"
."\n AND published = '1'"
."\n ORDER BY $order";
$db->setQuery( $query, 0, $limit );
$rows = $db->loadObjectList();
foreach($rows as $key => $row) {
$rows[$key]->href = 'index.php?option=com_imgweblinks&view=category&id ';
}
return $rows;
}
?>
Ein Link eines Ergebnisses, führt mich z.B. zu der Seite
http://www.australien-suche.de/index...y&id=&Itemid=2
Der Pfad ist ja oben so angegeben. Nur wo kommt das "=&Itemid=2" her?


LinkBack URL
About LinkBacks
Zitieren


Lesezeichen