Artikelliste
Verfasst: Mo 5. Jan 2004, 17:08
Ich würde gern meine Artikelliste so umschreiben, dass nur die 5 letzten Einträge angezeigt werden, bekomme das aber leider nicht so richtig hin. So sieht mein Script Ausgabe Modul für die Artikelliste aus:
Hat jemand vielleicht eine Idee wie man sowas machen könnte?<?php
$selcat = "CMS_VALUE[0]"; // selected category
if($selcat!="0" && $selcat!=""){
// select all articles in category
$query = "SELECT ARTLANG.idart, ARTLANG.idartlang FROM ".$cfg["tab"]["cat_art"]." AS CATART, ".
$cfg["tab"]["art_lang"]." AS ARTLANG ".
"WHERE CATART.idcat = '$selcat' AND ARTLANG.idart = CATART.idart AND ARTLANG.idlang = '$lang' AND CATART.is_start = '0' AND ".
"ARTLANG.online = '1' ORDER BY CATART.idart DESC";
// execute query
$db->query($query);
unset($articleID);
unset($linkID);
// get id's of sub articles
while ($db->next_record()) {
$articleID[] = $db->f("idartlang");
$linkID[] = $db->f("idart");
} // end while
// Table header
echo '
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr><td height="21" width="8"></td>
<td width="143" style="padding-left:5px" class="punkte">CMS_VALUE[2]</td></tr>';
// Loop through articles
if (is_array($articleID)) {
foreach ($articleID as $key => $value) {
// select all CMS variables of the article
$sql = "SELECT * FROM ".$cfg["tab"]["content"]." WHERE idartlang = '$value' AND idtype = '1' AND typeid = '1'";
$db->query($sql);
$db->next_record();
$headline = urldecode($db->f("value"));
if (strlen($headline) > CMS_VALUE[3]) {
$headline = substr($headline, 0, CMS_VALUE[3]);
$headline .= '..';
}
// link
$link = $sess->url("front_content.php?client=$client&lang=$lang&idcat=$selcat&idart=$linkID[$key]&m=$m&s=$s");
echo '<tr>
<td height="21" width="8" valign="middle"><img src="images/newsArrow.gif" width="8" height="9" border="0"></td> <td colspan="2" class="text" height="21" style="background-color: #E8E8E8; padding-left:5px"><a href="'.$link.'">'.$headline.'</a></td></tr>';
} // end while
unset($headline);
} // end foreach
} // end if (is_array)
echo '</table><br>';
?>