Zusätzlich möchte ich auf anderen Seiten die ersten 4 Artikel als wiederkehrende Elemente referenzieren.
Es interessiert mich, ob mir jemand helfen kann dieses Modul dazu zu bewegen die ersten vier Einträge aufzulisten & nicht alle.
Meine PHP-Kenntnisse reichen dafür leider nicht aus.
Mit vielem Dank im voraus
Code: Alles auswählen
// selected category
$selected = "CMS_VALUE[0]";
// funktion für die checkboxen
function d_checked($which) {
if ($which != "") {
return "checked";
}
} // end function
echo "<table cellspacing=\"0\" cellpadding=\"2\" border=\"0\">
<tr bgcolor=\"#DFE4E4\" valign=\"top\">
<td></td>
<td><input type=\"checkbox\" value=\"on\" ".d_checked("CMS_VALUE[9]")." name=\"CMS_VAR[9]\"></td>
<td width=\"120\">Ausgabe mit Startartikel</td>
<td></td>
<td>Kategorie wählen:<br>
<select name=\"CMS_VAR[0]\">";
if($selected!="0" && $selected!=""){
echo"<option value=\"0\">--- kein ---</option>";
}else{
echo"<option selected=\"selected\" value=\"0\">--- kein ---</option>";
}
// fetch all categorys
$query = "SELECT A.idcat, A.level, C.name FROM ".$cfg["tab"]["cat_tree"]." AS A, ".
$cfg["tab"]["cat"]." AS B, ".$cfg["tab"]["cat_lang"]." AS C WHERE A.idcat=B.idcat ".
"AND B.idcat=C.idcat AND C.idlang='$lang' AND B.idclient='$client' ".
"AND C.visible=1 ORDER BY A.idtree";
// execute query
$db->query($query);
// loop result and build the options
while ($db->next_record()) {
// indent spacer
$spaces = "|";
// how many levels
$levels = $db->f("level");
for ($i = 0; $i < $levels; $i ++) {
// add 2 spaces for every level
$spaces = $spaces . "--";
} // end for
$spaces .= ">";
if ($selected == $db->f("idcat")) {
// selected category
echo "<option selected=\"selected\" value=\"". $db->f("idcat") ."\">". $spaces . $db->f("name") ."</option>";
} else {
// category
echo "<option value=\"". $db->f("idcat") ."\">". $spaces . $db->f("name") ."</option>";
} // end if
} // end while
echo "</select>";
echo "</td>
</tr>
<tr valign=\"top\">
<td></td>
<td></td>
<td width=\"120\"></td>
<td></td>
<td>Überschrift: (wenn leer, keine Ausgabe)<br>
<input type=\"text\" name=\"CMS_VAR[2]\" value=\"CMS_VALUE[2]\" size=\"24\"></td>
</tr>
<tr bgcolor=\"#DFE4E4\" valign=\"top\">
<td></td>
<td> <input type=\"checkbox\" value=\"on\" ".d_checked("CMS_VALUE[4]")." name=\"CMS_VAR[4]\"> </td>
<td width=\"120\">Ausgabe der Artikel-Headline</td>
<td></td>
<td>Angezeigte Länge der Artikel-Headline in Zeichen:<br>
<input type=\"text\" name=\"CMS_VAR[3]\" value=\"CMS_VALUE[3]\" size=\"24\"></td>
</tr>
<tr valign=\"top\">
<td></td>
<td><input type=\"checkbox\" value=\"on\" ".d_checked("CMS_VALUE[5]")." name=\"CMS_VAR[5]\"></td>
<td width=\"120\">Ausgabe der Artikel-Subheadline:</td>
<td></td>
<td>Angezeigte Länge der Artikel-Subheadline in Zeichen:<br>
<input type=\"text\" name=\"CMS_VAR[6]\" value=\"CMS_VALUE[6]\" size=\"24\"></td>
</tr>
<tr bgcolor=\"#DFE4E4\" valign=\"top\">
<td></td>
<td> <input type=\"checkbox\" value=\"on\" ".d_checked("CMS_VALUE[10]")." name=\"CMS_VAR[10]\"> </td>
<td width=\"120\">Ausgabe von Datum und Ort</td>
<td></td>
<td>Angezeigte Länge in Zeichen:<br>
<input type=\"text\" name=\"CMS_VAR[11]\" value=\"CMS_VALUE[11]\" size=\"24\"></td>
</tr>
<tr bgcolor=\"#DFE4E4\" valign=\"top\">
<td></td>
<td><input type=\"checkbox\" value=\"on\" ".d_checked("CMS_VALUE[7]")." name=\"CMS_VAR[7]\" ></td>
<td width=\"120\">Ausgabe der Thumbnails:</td>
<td></td>
</tr>
<tr valign=\"top\">
<td></td>
<td></td>
<td width=\"120\"></td>
<td></td>
<td></td>
</tr>
</table>
"; // Ende
Code: Alles auswählen
<?
/***********************************************
* CONTENIDO MODUL - OUTPUT
*
* Erweiterte Artikel liste
*
* Liste von Artikeln mit mehreren Daten basierend
* auf 4fb referenz modul
* Gibt die Subheadline eines Artikel mit aus (anstatt des Summery) upt.
*
* Author : Evert Smit / Dirk Uptmoor
* Copyright : 4fB
* Created : 13-07-2003
* Modified : 16-08-2002 /20-9-2003 upt
************************************************/
$startarton = "AND CATART.is_start = '0' AND";
//soll der startartikel mit ausgegeben werden?.
$print_startartikel = "CMS_VALUE[9]";
if($print_startartikel !=""){
$startarton = "AND";
}
//die Überschrift wird ausgegeben wenn sie nicht leer ist.
$print_mainheadline = "CMS_VALUE[2]";
//soll headline ausgegeben werden?
$print_headline = "CMS_VALUE[4]";
//soll subheadline ausgegeben werden?
$print_subheadline = "CMS_VALUE[5]";
//soll ein thumnail ausgegeben werden?
$print_thumbnail = "CMS_VALUE[7]";
//soll das Datum ausgegeben werden?
$print_date = "CMS_VALUE[10]";
//thumbnail breite
//$thumbnail_width = "CMS_VALUE[8]";
//wenn thumbnails = 0
$imagetag = "";
// second db class instance
$db2 = new DB_Contenido;
// selected category
$selcat = "CMS_VALUE[0]";
if($selcat!="0" && $selcat!=""){
// select all articles in category widthout start article
$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' "." $startarton " ."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
/****************** start table **************************/
echo '
<table border="0" cellpadding="3" cellspacing="0" width="100%"
';
/**** Überschrift der Artikelliste wird ausgegeben, wenn nicht leer ********/
//if($print_mainheadline !=""){
//echo '
//<tr>
//<td class="headline"> CMS_VALUE[2] <br></td>
//<td align="right"> </td>
//</tr>
//
//<tr>
//<td bgcolor="#fcf2d5" class="text"> </td>
//<td align="right" bgcolor="#fcf2d5"> </td>
//</tr>
//';
//}
// Loop through articles
if (is_array($articleID)) {
foreach ($articleID as $key => $value) {
// select all CMS variables of the article
if($print_headline!="0" && $print_headline!=""){
$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 .= '..';
}
}
if($print_subheadline!="0" && $print_subheadline!=""){
$sql_subheadline = "SELECT * FROM ".$cfg["tab"]["content"]." WHERE idartlang = '$value' AND idtype = '1' AND typeid = '2'";
$db->query($sql_subheadline);
$db->next_record();
$subheadline = urldecode($db->f("value"));
if ( strlen($subheadline) > CMS_VALUE[6]) {
$subheadline = substr($subheadline , 0, CMS_VALUE[6]);
$subheadline .= '..';
}
}
if($print_date!="0" && $print_date!=""){
$sql_date = "SELECT * FROM ".$cfg["tab"]["content"]." WHERE idartlang = '$value' AND idtype = '1' AND typeid = '3'";
$db->query($sql_date);
$db->next_record();
$date = urldecode($db->f("value"));
if ( strlen($date) > CMS_VALUE[11]) {
$date = substr($date , 0, CMS_VALUE[11]);
$date .= '..';
}
}
/******************* begin thumbnails **********************************/
if($print_thumbnail !="0" && $print_thumbnail !=""){
// select and resolve image path
$imagesql="select value from ".$cfg["tab"]["content"]." where idartlang='$value' and idtype='4' and typeid='1'";
$db2->query($imagesql);
$db2->next_record();
$image_id= $db2->f("value");
// get image name and path
$imagesql="select * from ".$cfg["tab"]["upl"]." where idupl='$image_id'";
$db2->query($imagesql);
$db2->next_record();
$webdir='upload/';
$thumbdir='thumbnails/';
$image=$webdir.$thumbdir.$db2->f('filename');
$imagetag="<img src=\" $image \" border=0>";
} // ende wenn keine thumbs gewünscht
/**************** Ende Thumbnails ***********************/
// link
$link = $sess->url("front_content.php?client=$client&lang=$lang&idcat=$selcat&idart=$linkID[$key]&m=$m&s=$s");
/***********************Anfang Tablezeile für Artikelliste**********************/
echo '<table border="0" width="100%" cellspacing="6" cellpadding="0">
<tr valign="top"><td>
<table width="148" border="0" cellspacing="0" cellpadding="0" class="fliess">
<tr><td bgcolor="#FFFFDA"><a href="'.$link.'">'.$headline.'</a></td></tr>
<tr><td bgcolor="#FFFFDA">Geburtsdatum: '.$date.'</td></tr>
<tr><td bgcolor="#FFFFDA"> </td></tr>
<tr><td bgcolor="#FFFFDA">'.$subheadline.'</td></tr>
<tr><td bgcolor="#FFFFDA"></td></tr>
<tr><td align="right">
<table border="0" width="100%" cellspacing="0" cellpadding="0" class="fliess_u">
<tr><td align="left"><img border="0" src="../../layout_images/pfeil.gif"><a href="'.$link.'" class="fliess_u"><u>Zum Datenblatt</u></a></td>
</tr>
</table>
</td></tr>
</table></td>
<td align="right"><A HREF="'.$link.'">'.$imagetag.'</a></td>
</tr>
</table>
<table border="0" width="100%" cellspacing="0" cellpadding="0" bgcolor="#E6E1BA">
<tr>
<td></td>
</tr>
</table>
';
} // end while
unset($headline);
unset($subheadline);
} // end foreach
} // end if (is_array)
/***********************ende Table**********************/
?>