Das Artikel-Bättern-Modul von forseth.de verwende ich schon einige Zeit in einer 4.4.5 Installation - es funktioniert äußerst zuverlässig. Mir gefällt es so gut, weil es einfach und schlicht ist:
Rechts und links die Links zum Blättern (zurück und vor), in der Mitte wird ausgegeben "zurück zur Übersicht" und "Artikel x von y". Außerdem zeigt es das Erstellungsdatum des Artikels mit an.
Meine Frage: was muss ggfs. geändert werden, damit es auch unter 4.6.4 zuverlässig den Startartikel ausschließt - ich hab da keinen Schimmer - SORRY


Code: Alles auswählen
<?php
##################################
# OUTPUT - Newsartikelblaettern #
# #
# Author: Lars D. Forseth #
# <lars@forseth.de> #
# Created: Feb. 5th 2004 #
# #
##################################
// get articles from DB
$sql = "SELECT ARTLANG.idart, ARTLANG.title, CATART.idcat, ARTLANG.created, CONTENT.value, ".
"CONTENT.idtype, CONTENT.typeid FROM ".$cfg["tab"]["cat_art"]." AS CATART, ".
$cfg["tab"]["art_lang"]." AS ARTLANG, ".$cfg["tab"]["cat"]." AS CAT, ".
$cfg["tab"]["content"]." AS CONTENT WHERE ARTLANG.idart = CATART.idart ".
"AND CATART.idcat = CAT.idcat AND ARTLANG.idartlang=CONTENT.idartlang ".
"AND CONTENT.idtype<=2 AND CONTENT.typeid<=2 AND CAT.idcat='$idcat' AND ARTLANG.idlang = '$lang' ".
"AND ARTLANG.online = '1' AND CATART.is_start='0' ORDER BY ARTLANG.artsort ASC,ARTLANG.created ".
"DESC";
$db->query($sql);
/* there are articles */
if ($db->num_rows() != 0) {
$db->next_record(); // get first row
$links = explode('?',$PHP_SELF);
$link = $links[0]; // plain link
$rows = $db->num_rows(); // initialize number of articles
$last = $db->f("idart"); // id of last article
$first = $db->f("idart"); // initialize var for first article id
$articles = array(); // array for the ids of the articles
$created = " "; // initialize "created"
for ($i = 0; $i < $rows; $i++) {
// only add the id of not already added articles
if (!in_array(($db->f("idart")), $articles)) {$articles[$i] = $db->f("idart");}
// if fetched article is the current shown get "created"
if(($db->f("idart")) == $idart) {
$created = substr($db->f("created"),8,2).".".substr($db->f("created"),5,2).".".substr($db->f("created"),0,4);
} // end if
$first = $db->f("idart");
$db->next_record();
} // end for
$articles = array_values($articles); // resort articles in correct form ([0],[1],[2],...)
$rows = count($articles); // number of articles
$key = array_search($idart, $articles); // position of current idart in articles-array
// check for prev-link
if (($key+1) < $rows) {
$prev = $link."?lang=".$lang."&client=".$client."&idcat=".$idcat."&idart=".$articles[($key+1)];
} else {$prev = " ";}
// check for next-link
if (($key-1) >= 0) {
$next = $link."?lang=".$lang."&client=".$client."&idcat=".$idcat."&idart=".$articles[($key-1)];
} else {$next = " ";}
// print next- and prev-link, if necessary
echo "
<!-- start Artikelblättern -->
<br><br><div align=\"right\" class=\"text\"><b>Erstellt am ".$created." .</b></div>
<br><br><br><br><br><br><br>
<table border =\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"0\" align=\"center\" class=\"text\">
<tr valign=\"top\">
<td align=\"left\" width=\"45\">";
if($next != " ") {echo "<a href=\"".$next."\"> « next </a>";}
else {echo $next;}
echo "</td>
<td align=\"center\">– Artikel ".($key+1)." / ".$rows." –</td>
<td align=\"right\" width=\"45\">";
if ($prev != " ") {echo "<a href=\"".$prev."\"> prev » </a>";}
else {echo $prev;}
echo "</td>
</tr>
<tr valign=\"bottom\">
<td colspan=\"3\" align=\"center\">
<a href=\"".$link."?idcat=".$idcat."\">« Zurück zur Übersicht »</a>
</td>
</tr>
<tr><td colspan=\"3\"> </td></tr>
<tr><td colspan=\"3\"> </td></tr>
</table>
<!-- end Artikelblättern -->
";
} // end "there are articles"
/* there are no articles */
else {
echo "Momentan sind keine Artikel vorhanden...";
} // end else
?>
Gruß CP