hier der Code
_____________________________________________________________
[INPUT]
Code: Alles auswählen
/**
* Artikelliste
*
* Liste von Artikeln mit mehreren Daten basierend
* auf 4fb referenz modul
* 1.Gibt die Subheadline eines Artikel mit aus
* 2.Anschnitte nur nach ganzen Wörtern
* 3.Thumnails werden vernünftig berechnet
* 4.Image für Erzeugung von Thumbs kann gewählt werden
* Author : Evert Smit / Dirk Uptmoor / Peter Beauvain
* Copyright : None
* Created : 13-07-03
* Modified : 16-08-02 /20-09-03 upt /02-02-04 Beau
*/
// selected category
$selected = "CMS_VALUE[0]";
$seldir = "CMS_VALUE[9]";
$selimg = "CMS_VALUE[11]";
//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=\"#E8E8EE\" valign=\"top\">
<td></td>
<td><input type=\"checkbox\" value=\"on\" ".d_checked("CMS_VALUE[14]")." name=\"CMS_VAR[14]\"></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>
<td></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=\"#E8E8EE\" 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 Zeichen Artikel-Headline:<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 Zeichen Artikel-Subheadline:<br>
<input type=\"text\" name=\"CMS_VAR[6]\" value=\"CMS_VALUE[6]\" size=\"24\"></td>
</tr>
<tr valign=\"top\">
<td></td>
<td><input type=\"checkbox\" value=\"on\" ".d_checked("CMS_VALUE[12]")." name=\"CMS_VAR[12]\"></td>
<td width=\"120\">Ausgabe des Artikel-Texts:</td>
<td></td>
<td>Angezeigte Zeichen Artikel-Text:<br>
<input type=\"text\" name=\"CMS_VAR[13]\" value=\"CMS_VALUE[13]\" size=\"24\"></td>
</tr>
<tr bgcolor=\"#E8E8EE\" valign=\"top\">
<td></td>
<tr bgcolor=\"#E8E8EE\" 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>
<td>Bildcontainer für Thumbnail Quelle:<br>";
$db = new DB_Contenido;
$query = "SELECT output AS out, name AS beschreibung FROM ".$cfg["tab"]["mod"]." ";
$db->query($query);
echo"<select name=\"CMS_VAR[11]\">";
echo"<option value=\"kein\">-- kein --</option> ";
while ($db->next_record()) {
$frontendpath = $db->f("out");
$name = $db->f("beschreibung");
$rest = substr("$frontendpath", 3, 30);
$find = strpos($rest,"CMS_IMG");
if ($find === false) {
}
else {
$ok = substr($rest, $find, 10);
$nummer = substr($ok, 8, 1);
?>
<option value="<?php echo $nummer ?>"<?php if ($selimg == $nummer) echo " selected" ?>><?php echo $db->f("beschreibung") ?>
<?
}
}
echo" </option> </select> ";
echo"</td>
</tr>
<td></td><td></td>
<td width=\"120\">Thumbnail Ordner</td>
<td></td><td>Bitte wählen:<br><select name=\"CMS_VAR[9]\" size=\"1\">";
echo"<option value=\"kein\">-- kein --</option>";
$db = new DB_Contenido;
$query = "SELECT DISTINCT dirname FROM ".$cfg["tab"]["upl"]." ORDER BY dirname ASC";
$db->query($query);
while ($db->next_record()) {
?>
<option value="<?php echo $db->f("dirname") ?>"<?php if ($seldir == $db->f("dirname")) echo " selected" ?>><?php echo $db->f("dirname") ?></option>
<?php
}
echo "</select></td>
<tr valign=\"top\">
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
</table>
"; //Ende
______________________________________________________________________
[OUTPUT]
Code: Alles auswählen
<?php
/********************************************************
* Newsmodul - OUTPUT
*
* Es wurde Code vom Modul "Artikelliste" von "(c) Author Jan Lengowski" verwendet!
*
* Author : Lars D. Forseth <lars@forseth.de>
* Created : Feb. 4th 2004
*********************************************************/
/* number of latest articles to get */
$anzahl = "CMS_VALUE[8]";
if((!$anzahl) or ($anzahl < 1)) {$anzahl = 10;}
/* length of extract */
$laenge = "CMS_VALUE[9]";
if((!$lange) or ($laenge <= 0)) {$laenge = 250;}
//echo $laenge;
// get $anzahl 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);
if ($db->num_rows() != 0) {
echo "
<table width=\"500\"align=\"left\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" class=\"text\">";
$artikel = array(array());
$j=0;
$db->next_record();
$idart_last=$db->f("idart");
for ($i=0; $i < ($db->num_rows()); $i++) {
$artikel[$j][0] = $db->f("idart");
$artikel[$j][1] = $db->f("idcat");
$artikel[$j][2] = substr($db->f("created"),8,2).".".substr($db->f("created"),5,2).".".substr($db->f("created"),0,4);
while ($idart_last == $db->f("idart")) {
if (($db->f("idtype") == 2) && ($db->f("typeid") == 1)) {
/* filter article text */
$html_text = strip_tags(urldecode($db->f("value")));
$array = array ("ä" => "ä", "ö" => "ö", "ü" => "ü", "ß" => "ß", "Ä" => "Ä", "Ö" => "Ö", "Ü" => "ü", " " => " ", """ => "\"", "<" => "<", ">" => ">", "&" => "&");
$html_text = strtr($html_text, $array);
for ($d=$laenge; $d < $laenge+20; $d++) {
$cut = substr($html_text, $d);
if ((ord ($cut) == 32)||(ord ($cut) == 44)||(ord ($cut) == 45)) {
$html_text = substr($html_text , 0, $d);
} // end if
} // end for
$html_text = htmlentities(substr($html_text,0,$laenge))." ....";
/* search for words longer than 50 chars and shorten them + \n */
$c = 0;
for ($n=0; $n < strlen($html_text); $n++) {
$c++;
if (($html_text[$n] == " ") or ($html_text[$n] == "\n") or ($html_text[$n] == "\r")) {$c = 0;}
if ($c > 48) {
$html_text = substr_replace($html_text, "-\n", $n, 0);
$n = $n+4;
$c = 0;
} // end if($c>45)
} // end for
$html_text = nl2br($html_text);
$artikel[$j][5] = str_replace("<br />", "<br>", $html_text);
} elseif (($db->f("idtype") == 1) && ($db->f("typeid") == 1)) {
$artikel[$j][3] = strip_tags(urldecode($db->f("value")));
} elseif (($db->f("idtype") == 1) && ($db->f("typeid") == 2)) {
$artikel[$j][4] = strip_tags(urldecode($db->f("value")));
} // end elseif
$idart_last = $db->f("idart");
$db->next_record();
$i++;
} // end while
$idart_last = $db->f("idart");
$j++;
$i--;
} // end for
if((!$blatt) or ($blatt == "") or ($blatt < 0)) $blatt = 0;
$blattmax = ((ceil($j/$anzahl)));
$blatt1 = $blatt+1;
// print articles
for ($i=$anzahl*$blatt; $i < min($j,$anzahl*$blatt+$anzahl); $i++) {
$k = $i-1;
$navmod_link ="front_content.php?client=$client&lang=$lang&idcat=".$artikel[$i][1]."&idart=".$artikel[$i][0]."";
echo "
<tr>";
echo "
<td style=\"border-bottom: Black 1px solid;\" valign=\"top\">".
"<a href=\"".$sess->url("$navmod_link")."\"><b>".$artikel[$i][3]."</b></a>". // title of article
"</td>".
"<td style=\"border-bottom: Black 1px solid;\" valign=\"top\" align=\"right\"><b>".$artikel[$i][2]."</b></td>". // date of article
"</tr>
<tr>".
"<td valign=\"top\" colspan=\"2\">".$artikel[$i][5]." ". // extract of article
"<br><div align=\"left\"><a href=\"".$sess->url("$navmod_link")."\">". // "more" link
"<b>»» weiterlesen</b></a>".
"</div><br>".
"</td>
</tr>
";
} // end for
// print page-prev- and page-next-link, if necessary
if ($j > $anzahl) {
echo "
<tr>
<td colspan=\"3\">
<table align=\"center\" width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" class=\"text\">
<tr valign=\"top\">".
"<td width=\"60\" align=\"left\">";
if ($blatt1 > 1) {
$navmod_link ="front_content.php?client=$client&lang=$lang&idcat=$idcat&blatt=".($blatt-1)."";
echo "
<a href=\"".$sess->url("$navmod_link")."\"><i>« prev</i></a>";
} else {echo " ";}
echo "
</td>".
"<td align=\"center\">– Seite ".$blatt1." / ".$blattmax." –</td>".
"<td width=\"40\" align=\"left\">";
if ($blatt1 < $blattmax) {
$navmod_link ="front_content.php?client=$client&lang=$lang&idcat=$idcat&blatt=".($blatt+1)."";
echo "
<a href=\"".$sess->url("$navmod_link")."\"><i>next »</i></a>";
} else {echo " ";}
echo "
</td>".
"</tr>
<tr><td colspan=\"3\" height=\"15\"> </td></tr>
</table>
</td>
</tr>
";
} // end if($j>$anzahl)
echo '</table>';
} // end if($db->num_rows() != 0)
/* no news articles in DB */
else {echo "<br><br><br>Momentan sind keine Artikel vorhanden...<br><br>";}
?>
anzuschauen unter
www.uni-gruen.de.vu ODER www.asta.uni-konstanz.de/hsg/gruene/
würde es gerne so ändern, dass da in Zukunft statt dem erstell-Datum das Veranstaltungsdatum erscheint. - geht das irgendwie ?
oder kann ich zumindest die Artikel nach dem Sortierschlüssel sortieren?
Vielen Dank
mfg
volker