Verfasst: Fr 17. Jun 2005, 12:27
Das braucht ein bisschen (vielleicht morgen).
Gruß
HerrB
Gruß
HerrB
Das Diskussionsforum zum Open Source Content Management System
https://forum.contenido.org/
Code: Alles auswählen
Artikelliste V4.4.5 V2.1beta
Basiert auf der Standardartikelliste von Contenido V4.4.x (Autor: Jan Legowski, 4fb).
Überarbeitet von HerrB, 18.06.2005Code: Alles auswählen
$selected = "CMS_VALUE[0]"; // selected category
echo ' <table cellspacing="0" cellpadding="10" border="0">',chr(10);
echo ' <tr valign="top">',chr(10);
echo ' <td class="text_medium">Kategorie wählen:</td>',chr(10);
echo ' <td class="text_medium" colspan="2"><select name="CMS_VAR[0]">',chr(10);
if ($selected != "0" && $selected != "") {
echo ' <option value="0">--- kein ---</option>',chr(10);
} else {
echo ' <option selected="selected" value="0">--- kein ---</option>',chr(10);
}
// fetch all categorys
$query = "SELECT A.idcat, A.level, C.name FROM ".$cfg["tab"]["cat_tree"]." AS A, ";
$query .= $cfg["tab"]["cat"]." AS B, ".$cfg["tab"]["cat_lang"]." AS C WHERE A.idcat=B.idcat ";
$query .= "AND B.idcat=C.idcat AND C.idlang='$lang' AND B.idclient='$client' ";
$query .= "AND C.visible=1 ORDER BY A.idtree";
// execute query
$db->query($query);
// loop result and build the options
while ($db->next_record()) {
$spaces = "|"; // indent spacer
$levels = $db->f("level"); // how many levels
for ($i = 0; $i < $levels; $i++) {
$spaces = $spaces . "--"; // add 2 spaces for every level
}
$spaces .= ">";
if ($selected == $db->f("idcat")) {
// selected category
echo '<option selected="selected" value="'. $db->f("idcat") .'">'. $spaces . $db->f("name") .'</option>',chr(10);
} else {
// category
echo '<option value="'. $db->f("idcat") .'">'. $spaces . $db->f("name") .'</option>',chr(10);
}
}
echo ' </select>',chr(10);
echo ' </td>',chr(10);
echo ' </tr>',chr(10);
echo ' <tr>',chr(10);
echo ' <td class="text_medium">Überschrift</td>',chr(10);
echo ' <td class="text_medium" colspan="2"><input type="text" name="CMS_VAR[2]" value="CMS_VALUE[2]"></td>',chr(10);
echo ' </tr>',chr(10);
echo ' <tr>',chr(10);
echo ' <td class="text_medium">Angezeigte Länge in Zeichen</td>',chr(10);
if (!is_numeric("CMS_VALUE[3]")) {
echo ' <td class="text_medium" colspan="2"><input type="text" name="CMS_VAR[3]" value="50"></td>',chr(10);
} else {
echo ' <td class="text_medium" colspan="2"><input type="text" name="CMS_VAR[3]" value="CMS_VALUE[3]"></td>',chr(10);
}
echo ' </tr>',chr(10);
echo ' <tr>',chr(10);
echo ' <td class="text_medium" style="vertical-align: top;">Sortiert nach:</td>',chr(10);
echo ' <td class="text_medium" colspan="2"><select name="CMS_VAR[4]">',chr(10);
if ("CMS_VALUE[4]" == "" || "CMS_VALUE[4]" == "CATART.idart") {
echo ' <option value="CATART.idart" selected>Artikel-ID</option>',chr(10);
} else {
echo ' <option value="CATART.idart">Artikel-ID</option>',chr(10);
}
if ("CMS_VALUE[4]" == "CONTENT.value") {
echo ' <option value="CONTENT.value" selected>Topic</option>',chr(10);
} else {
echo ' <option value="CONTENT.value">Topic</option>',chr(10);
}
if ("CMS_VALUE[4]" == "ARTLANG.created") {
echo ' <option value="ARTLANG.created" selected>Erstellungsdatum</option>',chr(10);
} else {
echo ' <option value="ARTLANG.created">Erstellungsdatum</option>',chr(10);
}
if ("CMS_VALUE[4]" == "ARTLANG.lastmodified") {
echo ' <option value="ARTLANG.lastmodified" selected>Änderungsdatum</option>',chr(10);
} else {
echo ' <option value="ARTLANG.lastmodified">Änderungssdatum</option>',chr(10);
}
if ("CMS_VALUE[4]" == "ARTLANG.title") {
echo ' <option value="ARTLANG.title" selected>Seitentitel (Backend)</option>',chr(10);
} else {
echo ' <option value="ARTLANG.title">Seitentitel (Backend)</option>',chr(10);
}
if ("CMS_VALUE[4]" == "ARTLANG.pagetitle") {
echo ' <option value="ARTLANG.pagetitle" selected>Seitentitel (Frontend)</option>',chr(10);
} else {
echo ' <option value="ARTLANG.pagetitle">Seitentitel (Frontend)</option>',chr(10);
}
if ("CMS_VALUE[4]" == "ARTLANG.summary") {
echo ' <option value="ARTLANG.summary" selected>Zusammenfassung (Backend)</option>',chr(10);
} else {
echo ' <option value="ARTLANG.summary">Zusammenfassung (Backend)</option>',chr(10);
}
if ("CMS_VALUE[4]" == "ARTLANG.artsort") {
echo ' <option value="ARTLANG.artsort" selected>Sort No.</option>',chr(10);
} else {
echo ' <option value="ARTLANG.artsort">Sort No.</option>',chr(10);
}
echo ' </select><br>',chr(10);
if ("CMS_VALUE[5]" != "DESC") {
echo ' <input type="radio" name="CMS_VAR[5]" value="ASC" checked>Aufsteigend <input type="radio" name="CMS_VAR[5]" value="DESC">Absteigend',chr(10);
} else {
echo ' <input type="radio" name="CMS_VAR[5]" value="ASC">Aufsteigend <input type="radio" name="CMS_VAR[5]" value="DESC" checked>Absteigend',chr(10);
}
echo ' </td>',chr(10);
echo ' </tr>',chr(10);
echo ' <tr>',chr(10);
echo ' <td class="text_medium" style="vertical-align: top;">Startartikel:</td>',chr(10);
if ("CMS_VALUE[6]" != "enabled") {
echo ' <td class="text_medium" colspan="2"><input type="checkbox" name="CMS_VAR[6]" value="enabled">Anzeigen ';
} else {
echo ' <td class="text_medium" colspan="2"><input type="checkbox" name="CMS_VAR[6]" value="enabled" checked>Anzeigen ';
}
if ("CMS_VALUE[7]" != "enabled") {
echo '<input type="checkbox" name="CMS_VAR[7]" value="enabled">An erster Stelle</td>',chr(10);
} else {
echo '<input type="checkbox" name="CMS_VAR[7]" value="enabled" checked>An erster Stelle</td>',chr(10);
}
echo ' </tr>',chr(10);
echo ' <tr>',chr(10);
echo ' <td class="text_medium" style="vertical-align: top;">Topic-Identifikation:</td>',chr(10);
echo ' <td class="text_medium" style="vertical-align: top;">Inhaltstyp:</td>',chr(10);
echo ' <td class="text_medium" style="vertical-align: top;"><select name="CMS_VAR[9]">',chr(10);
if (!is_numeric("CMS_VALUE[9]") || !in_array("CMS_VALUE[9]", array("-3","-2","-1","1","2","3","9"))) {
echo ' <option value="1" selected>CMS_HTMLHEAD</option>',chr(10);
} else {
echo ' <option value="1">CMS_HTMLHEAD</option>',chr(10);
}
if ("CMS_VALUE[9]" == "2") {
echo ' <option value="2" selected>CMS_HTML</option>',chr(10);
} else {
echo ' <option value="2">CMS_HTML</option>',chr(10);
}
if ("CMS_VALUE[9]" == "3") {
echo ' <option value="3" selected>CMS_TEXT</option>',chr(10);
} else {
echo ' <option value="3">CMS_TEXT</option>',chr(10);
}
if ("CMS_VALUE[9]" == "9") {
echo ' <option value="9" selected>CMS_HEAD</option>',chr(10);
} else {
echo ' <option value="9">CMS_HEAD</option>',chr(10);
}
if ("CMS_VALUE[9]" == "-1") {
echo ' <option value="-1" selected>Seitentitel (Frontend)*</option>',chr(10);
} else {
echo ' <option value="-1">Seitentitel (Frontend)*</option>',chr(10);
}
if ("CMS_VALUE[9]" == "-2") {
echo ' <option value="-2" selected>Seitentitel (Backend)*</option>',chr(10);
} else {
echo ' <option value="-2">Seitentitel (Backend)*</option>',chr(10);
}
if ("CMS_VALUE[9]" == "-3") {
echo ' <option value="-3" selected>Zusammenfassung (Backend)*</option>',chr(10);
} else {
echo ' <option value="-3">Zusammenfassung (Backend)*</option>',chr(10);
}
echo ' </select><br><font size="1">* Typ-Nummer wird ignoriert</font>',chr(10);
echo ' </td>',chr(10);
echo ' </tr>',chr(10);
echo ' <tr>',chr(10);
echo ' <td class="text_medium" style="vertical-align: top;"> </td>',chr(10);
echo ' <td class="text_medium" style="vertical-align: top;">Typ-Nummer:</td>',chr(10);
echo ' <td class="text_medium" style="vertical-align: top;">',chr(10);
if (!is_numeric("CMS_VALUE[8]")) {
echo ' <input type="text" name="CMS_VAR[8]" length="5" maxlength="10" value="1"><br><font size="1">z.B. 3 bei CMS_HTML[3]</font>',chr(10);
} else {
echo ' <input type="text" name="CMS_VAR[8]" length="5" maxlength="10" value="CMS_VALUE[8]"><br><font size="1">z.B. 3 bei CMS_HTML[3]</font>',chr(10);
}
echo ' </td>',chr(10);
echo ' </tr>',chr(10);
echo ' <tr>',chr(10);
echo ' <td class="text_medium">Artikelanzahl (0 = keine Begrenzung):</td>',chr(10);
if (!is_numeric("CMS_VALUE[10]")) {
echo ' <td class="text_medium" colspan="2"><input type="text" name="CMS_VAR[10]" value="0"></td>',chr(10);
} else {
echo ' <td class="text_medium" colspan="2"><input type="text" name="CMS_VAR[10]" value="CMS_VALUE[10]"></td>',chr(10);
}
echo ' </tr>',chr(10);
echo ' </table>',chr(10);Code: Alles auswählen
<?php
unset ($arrData);
$arrData = array();
$arrData["Category"] = "CMS_VALUE[0]"; // selected category
// 1 was used in previous versions
$arrData["Headline"] = "CMS_VALUE[2]"; // Table headline
$arrData["MaxChar"] = "CMS_VALUE[3]"; // Max. shown topic length
$arrData["OrderBy"] = "CMS_VALUE[4]"; // Order By selection
$arrData["AscDesc"] = "CMS_VALUE[5]"; // Asc or Desc sorting
$arrData["WithStart"] = "CMS_VALUE[6]"; // with start article?
$arrData["StartFirst"] = "CMS_VALUE[7]"; // Start article as first article in list?
$arrData["TypeCount"] = "CMS_VALUE[8]"; // Content type count, e.g. CMS_H T M L [3] -> $TypeCount = 3
$arrData["TypeID"] = "CMS_VALUE[9]"; // Content type id, e.g. CMS_H T M L or pagetitle (-2) or title (-1)
$arrData["Limit"] = "CMS_VALUE[10]"; // Max. article count
if (!is_numeric($arrData["MaxChar"]) || $arrData["MaxChar"] < 1) {
$arrData["MaxChar"] = "50";
}
if ($arrData["AscDesc"] == "") {
$arrData["AscDesc"] = "DESC ";
}
if (!is_numeric($arrData["TypeID"])) {
$arrData["TypeID"] = "1";
$arrData["TypeCount"] = "1";
}
if (!is_numeric($arrData["TypeCount"])) {
$arrData["TypeCount"] = "1";
}
if ($arrData["OrderBy"] == "" || ($arrData["TypeID"] < 0 && strpos($arrData["OrderBy"], "CONTENT") !== false)) {
// If no order by specified or an order by specified using CONTENT where no CONTENT is available ...
$arrData["OrderBy"] = "CATART.idart ";
}
if (is_numeric($arrData["Category"]) && $arrData["Category"] != "0") {
// select all articles in category without start article
switch ($arrData["TypeID"]) {
case "-3":
// Article title (Backend)
$query = "SELECT ARTLANG.summary AS topic, ARTLANG.idart AS id FROM ";
$query .= $cfg["tab"]["cat_art"]." AS CATART, ";
$query .= $cfg["tab"]["art_lang"]." AS ARTLANG ";
$query .= "WHERE ";
break;
case "-2":
// Article title (Backend)
$query = "SELECT ARTLANG.title AS topic, ARTLANG.idart AS id FROM ";
$query .= $cfg["tab"]["cat_art"]." AS CATART, ";
$query .= $cfg["tab"]["art_lang"]." AS ARTLANG ";
$query .= "WHERE ";
break;
case "-1":
// Pagetitle (Frontend)
$query = "SELECT ARTLANG.pagetitle AS topic, ARTLANG.idart AS id FROM ";
$query .= $cfg["tab"]["cat_art"]." AS CATART, ";
$query .= $cfg["tab"]["art_lang"]." AS ARTLANG ";
$query .= "WHERE ";
break;
default:
$query = "SELECT CONTENT.value AS topic, ARTLANG.idart AS id FROM ";
$query .= $cfg["tab"]["cat_art"]." AS CATART, ";
$query .= $cfg["tab"]["art_lang"]." AS ARTLANG, ";
$query .= $cfg["tab"]["content"]." AS CONTENT ";
$query .= "WHERE CONTENT.idartlang = ARTLANG.idartlang ";
$query .= "AND CONTENT.typeid = '".$arrData["TypeCount"]."' "; // Element count (CMS_H T M L [3] -> $TypeCount = 3)
$query .= "AND CONTENT.idtype = '".$arrData["TypeID"]."' AND "; // Content-Type
}
$query .= "CATART.idcat = '".$arrData["Category"]."' ";
$query .= "AND ARTLANG.idart = CATART.idart AND ARTLANG.idlang = '".$lang."' ";
$query .= "AND ARTLANG.online = '1' ";
if ($arrData["WithStart"] != "enabled") {
$query .= "AND CATART.is_start = '0' ";
}
// Sort by
$query .= "ORDER BY ";
if ($arrData["WithStart"] == "enabled" && $arrData["StartFirst"] == "enabled") { // Startartikel an erster Stelle
$query .= "CATART.is_start DESC, ";
}
$query .= $arrData["OrderBy"]." ";
$query .= $arrData["AscDesc"]." "; // ASC/DESC
// LIMIT
if (is_numeric($arrData["Limit"]) && $arrData["Limit"] > 0) {
$query .= "LIMIT 0, ".$arrData["Limit"];
}
// execute query
$db->query($query);
if ($db->num_rows() > 0) {
// Table header
echo '<table width="165" border="0" cellspacing="0" cellpadding="0">';
echo '<tr><td height="30" colspan="2" ></td></tr>';
echo '<tr><td height="21" width="22" style="border: 0px; border-top:1px; border-bottom:1px; border-color: #F7C473; border-style: solid; background-color: #FCF2D5"><img src="images/wuerfel.gif" width="22" height="21" border="0"></td>';
echo '<td width="143" style="border: 1px; border-left:0px; border-color: #F7C473; border-style: dashed; background-color: #FCF2D5; padding-left:10px" class="punkte">'.$arrData["Headline"].'</td></tr>';
while ($db->next_record()) {
$topic = urldecode($db->f("topic"));
if (strlen($topic) > $arrData["MaxChar"]) {
$topic = substr($topic, 0, $arrData["MaxChar"]);
$topic .= '..';
}
$link = $sess->url("front_content.php?client=$client&lang=$lang&idcat=$selCat&idart=".$db->f("id"));
echo '<tr><td colspan="2" class="text" height="22" style="border: 1px; border-top:0px; border-color: #F7C473; border-style: dashed; background-color: #FCF2D5; padding-left:10px"><a href="'.$link.'">'.$topic.'</a></td></tr>';
} // end while
unset($topic);
echo '</table><br>';
} // end if
} // end if
unset ($arrData);
?>Code: Alles auswählen
Parse error: parse error, unexpected '<' in /home/www/xxx/xxx/xxx/contenido/includes/include.con_editcontent.php(571) : eval()'d code on line 859Code: Alles auswählen
<?php
$selCat = "CMS_VALUE[0]"; // selected category
$maxChar = "CMS_VALUE[3]"; // Max. shown topic length
echo "Kategorie:" . $selCat;
Code: Alles auswählen
<?php
$selCat = $idcat;
Eigentlich richtig, aber passt für den speziellen fall nicht ganz.Halchteranerin hat geschrieben:Nebel, dafuer gibt's eigentlich die Terminverwaltungsmodule.![]()
Aber wie? Bin leider nicht wirklich fitt in php. Müsste irgendeine funktion sein, die erkennt, dass nur noch eine bestimmte Anzahl von Artikeln in der Kategorie ist (z.B. 2). Bei weniger als 2 wird dann ... ausgegeben.Halchteranerin hat geschrieben: Wenn du die Artikelliste erweiterst, kannst du sicherlich auch einen Text anzeigen lassen ...
Code: Alles auswählen
if ($db->num_rows() > 0) {
// Table header
echo '<table width="165" border="0" cellspacing="0" cellpadding="0">';
echo '<tr><td height="30" colspan="2" ></td></tr>';
echo '<tr><td height="21" width="22" style="border: 0px; border-top:1px; border-bottom:1px; border-color: #F7C473; border-style: solid; background-color: #FCF2D5"><img src="images/wuerfel.gif" width="22" height="21" border="0"></td>';
echo '<td width="143" style="border: 1px; border-left:0px; border-color: #F7C473; border-style: dashed; background-color: #FCF2D5; padding-left:10px" class="punkte">CMS_VALUE[2]</td></tr>';
while ($db->next_record()) {
$headline = urldecode($db->f("headline"));
if (strlen($headline) > $maxChar) {
$headline = substr($headline, 0, $maxChar);
$headline .= '..';
}
$link = $sess->url("front_content.php?client=$client&lang=$lang&idcat=$selCat&idart=".$db->f("id")."&m=$m&s=$s");
echo '<tr><td colspan="2" class="text" height="22" style="border: 1px; border-top:0px; border-color: #F7C473; border-style: dashed; background-color: #FCF2D5; padding-left:10px"><a href="'.$link.'">'.$headline.'</a></td></tr>';
} // end while
unset($headline);
echo '</table><br>';
} // end if Code: Alles auswählen
if ($db->num_rows() > 0) {
// Table header
echo '<table width="165" border="0" cellspacing="0" cellpadding="0">';
echo '<tr><td height="30" colspan="2" ></td></tr>';
echo '<tr><td height="21" width="22" style="border: 0px; border-top:1px; border-bottom:1px; border-color: #F7C473; border-style: solid; background-color: #FCF2D5"><img src="images/wuerfel.gif" width="22" height="21" border="0"></td>';
echo '<td width="143" style="border: 1px; border-left:0px; border-color: #F7C473; border-style: dashed; background-color: #FCF2D5; padding-left:10px" class="punkte">CMS_VALUE[2]</td></tr>';
while ($db->next_record()) {
$headline = urldecode($db->f("headline"));
if (strlen($headline) > $maxChar) {
$headline = substr($headline, 0, $maxChar);
$headline .= '..';
}
$link = $sess->url("front_content.php?client=$client&lang=$lang&idcat=$selCat&idart=".$db->f("id")."&m=$m&s=$s");
echo '<tr><td colspan="2" class="text" height="22" style="border: 1px; border-top:0px; border-color: #F7C473; border-style: dashed; background-color: #FCF2D5; padding-left:10px"><a href="'.$link.'">'.$headline.'</a></td></tr>';
} // end while
unset($headline);
echo '</table><br>';
} else {
echo 'Hier wird der HTML-Code ausgegeben, der erscheint, wenn nix zum ausgeben da ist';
} // end if Code: Alles auswählen
} else {
echo 'Hier wird der HTML-Code ausgegeben, der erscheint, wenn nix zum ausgeben da ist';Vielen Dank für die Nacht, die du dir für mich um die Ohren geschlagen hast!!!HerrB hat geschrieben:Uuuuh, das ist so Hölle schwer, da muss ich praktisch Geld verlangen für die Sek... öhm Stunden und Tage, die sowas braucht. Aber versuchen wir es gemeinsam.
...
Durch scharfes Hinsehen erkennt man, dass nur etwas ausgegeben wird, wenn die Anzahl der zurückgegebenen Artikel größer 0 ist ("if ($db->num_rows() > 0) {"). Hättste auch ohne mich gesehen, bin ich mir sicher...![]()
Das ist es! Wusste nicht wie ich das hinbekommeHerrB hat geschrieben:Code: Alles auswählen
} else { echo 'Hier wird der HTML-Code ausgegeben, der erscheint, wenn nix zum ausgeben da ist';
Überglücklich! Ehlich.Haben wir es geschafft. Glücklich? Glücklich.![]()