bei der suche kommen manche artikel doppelt und andere dafür gar nicht. beim suchindex erneuern hab ich auch so meine probleme, d.h. das script bricht ab. weiß jemand woran das liegen könnte?
kann man den suchindex ganz löschen und neu erstellen lassen und könnte mir jemand helfen, dieses modul so umzuschreiben, daß der cannot redeclare fehler nicht kommt?
Code: Alles auswählen
<?php
function sortArtName( $articleA, $articleB) {
$nameA = $articleA->getName();
$nameB = $articleB->getName();
if ( $nameA == $nameB) {
return 0;
}
$arr = array( $nameA, $nameB);
sort( $arr, SORT_STRING);
return $arr[0] == $nameA ? -1 : 1;
}
$cat = OOCategory::getCategoryById(REX_CATEGORY_ID);
$articles = $cat->getArticles( true);
usort( $articles, "sortArtName"); // sortieren
if (is_array($articles) && count( $articles) > 0) {
echo '<ul class="article-list">';
foreach ($articles as $article) {
// aktuellen Artikel nicht anzeigen
if( $article->getId() == REX_ARTICLE_ID) continue;
// keine Startartikel anzeigen
if ($article->isStartPage()) continue;
echo '<li><a href="'.$article->getUrl().'">'.$article->getName().'</a></li>';
}
echo '</ul>';
}
?>
Danke und Gruß