Hallo,
hab jetzt mal für das Artikelauflisten ohne Beschneidung das super Modul von HerrB genommen:
Code: Alles auswählen
Modul: Article List Advanced V4.6 V3.5.0
Author: Björn Behrens, HerrB
Created: 25.12.2005
Specification: Rezeptionist
Advanced List ohne Kürzung
Eingabe:
Code: Alles auswählen
#Includes
cInclude("frontend", "includes/functions.input.helper.php");
# Initialization
$bDebug = false;
unset ($aSettings);
$aSettings = array();
$aSettings["ArticleCount"] = "CMS_VALUE[0]";
$aSettings["TeaserLength"] = "CMS_VALUE[1]";
$aSettings["SortBy"] = "CMS_VALUE[2]";
$aSettings["SortDir"] = "CMS_VALUE[3]";
$aSettings["ShowStart"] = "CMS_VALUE[4]";
$aSettings["Category"] = "CMS_VALUE[5]";
$aSettings["SampleArt"] = "CMS_VALUE[6]";
$aSettings["HeadlineIdentifier"] = "CMS_VALUE[7]";
$aSettings["TextIdentifier"] = "CMS_VALUE[8]";
$aSettings["ImageIdentifier"] = "CMS_VALUE[9]";
$aSettings["ImageFromContent"] = "CMS_VALUE[10]";
$aSettings["ImageWidth"] = "CMS_VALUE[11]";
$aSettings["ImageHeight"] = "CMS_VALUE[12]";
# Checking values
if (!is_numeric($aSettings["ArticleCount"]) || $aSettings["ArticleCount"] < 0) {
$aSettings["ArticleCount"] = 5;
}
if (!is_numeric($aSettings["TeaserLength"]) || $aSettings["TeaserLength"] <= 0) {
$aSettings["TeaserLength"] = 50;
}
if (!is_numeric($aSettings["Category"]) || $aSettings["Category"] <= 0) {
$aSettings["Category"] = 0;
}
if (!is_numeric($aSettings["SampleArt"]) || $aSettings["SampleArt"] < 0) {
$aSettings["SampleArt"] = 0;
}
if (strlen($aSettings["HeadlineIdentifier"]) > 50) {
$aSettings["HeadlineIdentifier"] = "";
}
if (strlen($aSettings["TextIdentifier"]) > 50) {
$aSettings["TextIdentifier"] = "";
}
if (strlen($aSettings["ImageIdentifier"]) > 50) {
$aSettings["ImageIdentifier"] = "";
}
if (!is_numeric($aSettings["ImageWidth"]) || $aSettings["ImageWidth"] <= 0) {
$aSettings["ImageWidth"] = 0;
$aSettings["ImageHeight"] = 0;
}
if (!is_numeric($aSettings["ImageHeight"]) || $aSettings["ImageHeight"] <= 0) {
$aSettings["ImageWidth"] = 0;
$aSettings["ImageHeight"] = 0;
}
echo ' <table cellspacing="0" cellpadding="2" border="0" width="100%">', chr(10);
echo ' <tr valign="top">',chr(10);
echo ' <td class="text_medium">Überschrift</td>',chr(10);
echo ' <td class="text_medium"><input type="text_medium" name="CMS_VAR[1111]" value="CMS_VALUE[1111]"></td>',chr(10);
echo ' <td>'.mi18n("Article Count:").'</td>', chr(10);
echo ' <td><input type="text" name="CMS_VAR[0]" value="'.$aSettings["ArticleCount"].'" size="5" title="'.mi18n("Set to 0 to show all articles").'"></td>', chr(10);
echo ' </tr>', chr(10);
echo ' <tr valign="top">',chr(10);
echo ' <td>'.mi18n("Teaser length (max.):").'</td>', chr(10);
echo ' <td><input type="text" name="CMS_VAR[1]" value="'.$aSettings["TeaserLength"].'" size="5"></td>', chr(10);
echo ' </tr>', chr(10);
echo ' <tr valign="top">',chr(10);
echo ' <td>'.mi18n("Sort by:").'</td>', chr(10);
echo ' <td><select name="CMS_VAR[2]">',chr(10);
if ($aSettings["SortBy"] == "" || $aSettings["SortBy"] == "CATART.idart") {
echo ' <option value="CATART.idart" selected>'.mi18n("Article ID").'</option>',chr(10);
} else {
echo ' <option value="CATART.idart">'.mi18n("Article ID").'</option>',chr(10);
}
if ($aSettings["SortBy"] == "tblData.value") {
echo ' <option value="tblData.value" selected>'.mi18n("Headline").'</option>',chr(10);
} else {
echo ' <option value="tblData.value">'.mi18n("Headline").'</option>',chr(10);
}
if ($aSettings["SortBy"] == "ARTLANG.created") {
echo ' <option value="ARTLANG.created" selected>'.mi18n("Add Date").'</option>',chr(10);
} else {
echo ' <option value="ARTLANG.created">'.mi18n("Add Date").'</option>',chr(10);
}
if ($aSettings["SortBy"] == "ARTLANG.lastmodified") {
echo ' <option value="ARTLANG.lastmodified" selected>'.mi18n("Last Modified Date").'</option>',chr(10);
} else {
echo ' <option value="ARTLANG.lastmodified">'.mi18n("Last Modified Date").'</option>',chr(10);
}
if ($aSettings["SortBy"] == "ARTLANG.title") {
echo ' <option value="ARTLANG.title" selected>'.mi18n("Page Title (Backend)").'</option>',chr(10);
} else {
echo ' <option value="ARTLANG.title">'.mi18n("Page Title (Backend)").'</option>',chr(10);
}
if ($aSettings["SortBy"] == "ARTLANG.pagetitle") {
echo ' <option value="ARTLANG.pagetitle" selected>'.mi18n("Page Title (Frontend)").'</option>',chr(10);
} else {
echo ' <option value="ARTLANG.pagetitle">'.mi18n("Page Title (Frontend)").'</option>',chr(10);
}
if ($aSettings["SortBy"] == "ARTLANG.summary") {
echo ' <option value="ARTLANG.summary" selected>'.mi18n("Summary (Backend)").'</option>',chr(10);
} else {
echo ' <option value="ARTLANG.summary">'.mi18n("Summary (Backend)").'</option>',chr(10);
}
if ($aSettings["SortBy"] == "ARTLANG.artsort") {
echo ' <option value="ARTLANG.artsort" selected>'.mi18n("Sort No.").'</option>',chr(10);
} else {
echo ' <option value="ARTLANG.artsort">'.mi18n("Sort No.").'</option>',chr(10);
}
echo ' </select>',chr(10);
if ($aSettings["SortDir"] != "DESC") {
echo ' <input type="radio" name="CMS_VAR[3]" value="ASC" checked>'.mi18n("Ascending").' <input type="radio" name="CMS_VAR[3]" value="DESC">'.mi18n("Descending"),chr(10);
} else {
echo ' <input type="radio" name="CMS_VAR[3]" value="ASC">'.mi18n("Ascending").' <input type="radio" name="CMS_VAR[3]" value="DESC" checked>'.mi18n("Descending"),chr(10);
}
echo ' </tr>', chr(10);
echo ' <tr valign="top">',chr(10);
echo ' <td>'.mi18n("Start Article:").'</td>', chr(10);
if ($aSettings["ShowStart"] != "enabled") {
echo ' <td><input type="checkbox" name="CMS_VAR[4]" value="enabled">'.mi18n("Show").'</td>', chr(10);
} else {
echo ' <td><input type="checkbox" name="CMS_VAR[4]" value="enabled" checked>'.mi18n("Show").'</td>', chr(10);
}
echo ' </tr>', chr(10);
echo ' </table>', chr(10);
echo ' <table cellspacing="0" cellpadding="2" border="0" width="100%">', chr(10);
echo ' <tr valign="top">',chr(10);
echo ' <td colspan="2" class="textw_medium" style="background-color: #a9aec2; border: 1px solid #747488;">'.mi18n("Identify elements:").'</td>', chr(10);
echo ' </tr>', chr(10);
echo ' <tr valign="top">',chr(10);
echo ' <td colspan="2" class="text" style="border-left: 1px solid #747488; border-right: 1px solid #747488;">'.mi18n("Category:").'<br />'.fncBuildCategorySelect("CMS_VAR[5]", $aSettings["Category"], 0, "if (document.forms[0].elements['CMS_VAR[5]'].value != 'CMS_VALUE[5]') { document.forms[0].elements['CMS_VAR[6]'].disabled = true; document.forms[0].elements['CMS_VAR[7]'].disabled = true; document.forms[0].elements['CMS_VAR[8]'].disabled = true; document.forms[0].elements['CMS_VAR[9]'].disabled = true; } else { document.forms[0].elements['CMS_VAR[6]'].disabled = false; document.forms[0].elements['CMS_VAR[7]'].disabled = false; document.forms[0].elements['CMS_VAR[8]'].disabled = false; document.forms[0].elements['CMS_VAR[9]'].disabled = false;}").' <input type="image" src="images/submit.gif"></td>', chr(10);
echo ' </tr>', chr(10);
echo ' <tr valign="top">',chr(10);
echo ' <td colspan="2" class="text" style="border-left: 1px solid #747488; border-right: 1px solid #747488;">'.mi18n("Sample Article:").'<br />'.fncBuildArticleSelect("CMS_VAR[6]", $aSettings["Category"], $aSettings["SampleArt"], "if (document.forms[0].elements['CMS_VAR[6]'].value != 'CMS_VALUE[6]') { document.forms[0].elements['CMS_VAR[7]'].disabled = true; document.forms[0].elements['CMS_VAR[8]'].disabled = true; document.forms[0].elements['CMS_VAR[9]'].disabled = true; } else { document.forms[0].elements['CMS_VAR[7]'].disabled = false; document.forms[0].elements['CMS_VAR[8]'].disabled = false; document.forms[0].elements['CMS_VAR[9]'].disabled = false;}").' <input type="image" src="images/submit.gif"></td>', chr(10);
echo ' </tr>', chr(10);
echo ' <tr valign="top">',chr(10);
echo ' <td class="text" style="border-left: 1px solid #747488;">'.mi18n("Headline Element:").'</td>', chr(10);
echo ' <td class="text" style="border-right: 1px solid #747488;">'.fncBuildTypeSelect("CMS_VAR[7]", $aSettings["SampleArt"], $aSettings["HeadlineIdentifier"], "'1','2','3','9','17'").'</td>', chr(10);
echo ' </tr>', chr(10);
echo ' <tr valign="top">',chr(10);
echo ' <td class="text" style="border-left: 1px solid #747488;">'.mi18n("Text Element:").'</td>', chr(10);
echo ' <td class="text" style="border-right: 1px solid #747488;">'.fncBuildTypeSelect("CMS_VAR[8]", $aSettings["SampleArt"], $aSettings["TextIdentifier"], "'1','2','3','9','17'").'</td>', chr(10);
echo ' </tr>', chr(10);
echo ' <tr valign="top">',chr(10);
echo ' <td class="text" style="border-left: 1px solid #747488; border-bottom: 1px solid #747488;">'.mi18n("Image Element:").'</td>', chr(10);
echo ' <td class="text" style="border-right: 1px solid #747488; border-bottom: 1px solid #747488;">',chr(10);
if ($aSettings["ImageFromContent"] != "") {
echo ' <input type="checkbox" name="CMS_VAR[10]" value="enabled" checked onclick="document.forms[0].elements[\'CMS_VAR[9]\'].disabled = true;" />'.mi18n("From text").' <input type="image" src="images/submit.gif"> ',chr(10);
echo ' '.fncBuildTypeSelect("CMS_VAR[9]", $aSettings["SampleArt"], $aSettings["ImageIdentifier"], "'1','2','3','9','17'").' ', chr(10);
} else {
echo ' <input type="checkbox" name="CMS_VAR[10]" value="enabled" onclick="document.forms[0].elements[\'CMS_VAR[9]\'].disabled = true;" />'.mi18n("From text").' <input type="image" src="images/submit.gif"> ',chr(10);
echo ' '.fncBuildTypeSelect("CMS_VAR[9]", $aSettings["SampleArt"], $aSettings["ImageIdentifier"], "'4'").' ', chr(10);
}
echo ' '.mi18n("Width:").' <input type="text" name="CMS_VAR[11]" value="'.$aSettings["ImageWidth"].'" size="5" title="'.mi18n("Set to 0 to disable resize").'"> ', chr(10);
echo ' '.mi18n("Height:").' <input type="text" name="CMS_VAR[12]" value="'.$aSettings["ImageHeight"].'" size="5" title="'.mi18n("Set to 0 to disable resize").'"></td>', chr(10);
echo ' </tr>', chr(10);
echo ' </table>', chr(10);
Ausgabe:
Code: Alles auswählen
<?php
# Initialization
$bDebug = false;
unset ($aData);
$aData = array();
unset ($aSettings);
$aSettings = array();
$aSettings["ArticleCount"] = "CMS_VALUE[0]";
$aSettings["TeaserLength"] = "CMS_VALUE[1]";
$aSettings["SortBy"] = "CMS_VALUE[2]";
$aSettings["SortDir"] = "CMS_VALUE[3]";
$aSettings["ShowStart"] = "CMS_VALUE[4]";
$aSettings["Category"] = "CMS_VALUE[5]";
$aSettings["HeadlineIdentifier"] = "CMS_VALUE[7]";
$aSettings["TextIdentifier"] = "CMS_VALUE[8]";
$aSettings["ImageIdentifier"] = "CMS_VALUE[9]";
$aSettings["ImageFromContent"] = "CMS_VALUE[10]";
$aSettings["ImageWidth"] = "CMS_VALUE[11]";
$aSettings["ImageHeight"] = "CMS_VALUE[12]";
# Checking values
if (!is_numeric($aSettings["ArticleCount"]) || $aSettings["ArticleCount"] < 0) {
$aSettings["ArticleCount"] = 5;
}
if (!is_numeric($aSettings["TeaserLength"]) || $aSettings["TeaserLength"] <= 0) {
$aSettings["TeaserLength"] = 50;
}
if ($aSettings["SortBy"] == "") {
$aSettings["SortBy"] = "CATART.idart";
}
if ($aSettings["SortDir"] == "") {
$aSettings["SortDir"] = "DESC";
}
if (!is_numeric($aSettings["Category"]) || $aSettings["Category"] <= 0) {
$aSettings["Category"] = 0;
}
if (strlen($aSettings["HeadlineIdentifier"]) > 50) {
$aSettings["HeadlineIdentifier"] = "";
}
if (strlen($aSettings["TextIdentifier"]) > 50) {
$aSettings["TextIdentifier"] = "";
}
if (strlen($aSettings["ImageIdentifier"]) > 50) {
$aSettings["ImageIdentifier"] = "";
}
if (!is_numeric($aSettings["ImageWidth"]) || $aSettings["ImageWidth"] <= 0) {
$aSettings["ImageWidth"] = 0;
$aSettings["ImageHeight"] = 0;
}
if (!is_numeric($aSettings["ImageHeight"]) || $aSettings["ImageHeight"] <= 0) {
$aSettings["ImageWidth"] = 0;
$aSettings["ImageHeight"] = 0;
}
if ($aSettings["Category"] !== "0" && $aSettings["HeadlineIdentifier"] !== "") {
if (!is_object($db)) {
$db = new DB_Contenido;
}
$query = "SELECT tblData.value AS headline, ARTLANG.idart AS id, " ;
$query .= "CATLANG.startidartlang, ARTLANG.idartlang, CATART.idcatart AS idcatart FROM ";
$query .= $cfg["tab"]["cat_art"]." AS CATART, ";
$query .= $cfg["tab"]["art_lang"]." AS ARTLANG, ";
$query .= $cfg["tab"]["cat_lang"]." AS CATLANG, ";
$query .= $cfg["tab"]["content"]." AS tblData ";
$query .= "WHERE CATART.idcat = '".$aSettings["Category"]."' AND ARTLANG.idlang = '".$lang."' ";
$query .= "AND tblData.idartlang = ARTLANG.idartlang ";
$query .= "AND CATLANG.idlang = ARTLANG.idlang ";
$query .= "AND CATLANG.idcat = CATART.idcat ";
$query .= "AND ARTLANG.idart = CATART.idart ";
$query .= "AND ARTLANG.online = '1' ";
if ($aSettings["ShowStart"] != "enabled") {
$query .= "AND CATLANG.startidartlang != ARTLANG.idartlang ";
}
$query .= "AND ".$aSettings["HeadlineIdentifier"]." ";
// Sort by
$query .= "ORDER BY ";
$query .= $aSettings["SortBy"]." ".$aSettings["SortDir"]." ";
// LIMIT
if ($aSettings["ArticleCount"] > 0) {
$query .= "LIMIT 0, ".$aSettings["ArticleCount"];
}
// execute query
$db->query($query);
if ($db->num_rows() > 0) {
if (!is_object($db2)) {
$db2 = new DB_Contenido;
}
if (!is_object($db3)) {
$db3 = new DB_Contenido;
}
$i = 0;
while ($db->next_record()) {
$aData[$i] = array();
$aData[$i]["Link"] = $sess->url("front_content.php?idcat=".$aSettings["Category"]."&idart=".$db->f("id"));;
$aData[$i]["Headline"] = strip_tags(urldecode($db->f("headline")));
$aData[$i]["Text"] = "";
$aData[$i]["Image"] = array();
$aData[$i]["Image"]["ServerPath"] = "";
$aData[$i]["Image"]["WebPath"] = "";
$sql = "SELECT tblData.value AS value, tblData.idtype AS idtype, tblData.typeid AS typeid FROM ";
$sql .= $cfg["tab"]["cat_art"]." AS tblCatArt, ";
$sql .= $cfg["tab"]["art_lang"]." AS tblArtLang, ";
$sql .= $cfg["tab"]["content"]." AS tblData ";
$sql .= "WHERE tblData.idartlang = tblArtLang.idartlang AND ";
$sql .= "tblArtLang.idlang = '".$lang."' AND ";
$sql .= "tblArtLang.idart = tblCatArt.idart AND ";
$sql .= "tblCatArt.idcatart = '".$db->f("idcatart")."' AND (";
$sql_items = "";
if ($aSettings["TextIdentifier"] != "") {
$sql_items = "(".$aSettings["TextIdentifier"].")";
}
if ($aSettings["ImageIdentifier"] != "") {
if ($sql_items != "") {
$sql_items .= " OR (".$aSettings["ImageIdentifier"].")";
} else {
$sql_items = "(".$aSettings["ImageIdentifier"].")";
}
}
$sql .= $sql_items.")";
if ($bDebug) {
echo "<pre>".$sql."</pre>", chr(10);
}
// execute query
$db2->query($sql);
while ($db2->next_record()) {
$sTypeIdentifier = "tblData.idtype = '".$db2->f('idtype')."' AND tblData.typeid = '".$db2->f('typeid')."'";
# Note: The TypeIdentifier for one item may be the same as for another item.
# Therefore, we are storing the content everywhere as needed
if ($sTypeIdentifier == $aSettings["TextIdentifier"]) {
$sTmpValue = urldecode($db2->f('value'));
$aData[$i]["Text"] = $sTmpValue;
}
if ($sTypeIdentifier == $aSettings["ImageIdentifier"]) {
$sql = "";
if ($aSettings["ImageFromContent"] != "") {
$sTmpValue = urldecode($db2->f('value'));
$regEx = "/<img[^>]*?>.*?/i";
$match = array ();
preg_match($regEx, $sTmpValue, $match);
$regEx = "/(src)(=)(['\"]?)([^\"']*)(['\"]?)/i";
$img = array ();
preg_match($regEx, $match[0], $img);
$img_src = preg_split("/\//", $img[0]);
$img_name = $img_src[count($img_src) - 1];
$img_name = preg_replace("/\"/", "", $img_name);
# $img_split = preg_split("/\./", $img_name);
# $img_type = $img_split[count($img_split) - 1];
# $img_split2 = preg_split("/_/", $img_split[0]);
$name = $img_name;
#if (count($img_split2) > 1) {
# $img_x = $img_split2[count($img_split2) - 1];
# $img_y = $img_split2[count($img_split2) - 2];
# if (is_numeric($img_x) AND is_numeric($img_y)) {
# $suffix = "_".$img_x."_".$img_y.".".$img_type;
# $name = preg_replace("/$suffix/", "", $img_name);
# $name = $name.".[a-zA-Z]{3}";
# }
#}
if (strlen($name) > 0) {
$sql = "SELECT dirname, filename FROM ".$cfg["tab"]["upl"]." ";
$sql .= "WHERE filename REGEXP '$name'";
}
} else {
$sql = "SELECT dirname, filename FROM ".$cfg["tab"]["upl"]." ";
$sql .= "WHERE idupl = '".$db2->f('value')."'";
}
if ($bDebug) {
echo "<pre>".$sql."</pre>";
}
// execute query
if ($sql != "") {
$db3->query($sql);
if ($db3->next_record()) {
$aData[$i]["Image"]["ServerPath"] = $cfgClient[$client]["upl"]["path"].$db3->f('dirname').$db3->f('filename');
$aData[$i]["Image"]["WebPath"] = $cfgClient[$client]["upl"]["htmlpath"].$db3->f('dirname').$db3->f('filename');
}
}
}
}
$i++;
}
unset ($db2);
unset ($db3);
// Output data
if ('CMS_VALUE[111]' != ""){
echo '<table style="background-color: #ecedd6" width="100%" border="0"><tr><td>';
echo '<br />';
echo'<h2>CMS_VALUE[1111]</h2>';
echo '</td></tr></table>';
echo '<br />';
}
foreach ($aData as $aValue) {
if ($aSettings["ImageWidth"] == 0 || $aSettings["ImageHeight"] == 0) {
$image = $aValue["Image"]["WebPath"];
} else {
if ($aValue["Image"]["ServerPath"] != "" && file_exists($aValue["Image"]["ServerPath"])) {
#Scale image
$image = capiImgScale($aValue["Image"]["ServerPath"], $aSettings["ImageWidth"], $aSettings["ImageHeight"], false, false, 10, false);
} else {
$image = $aValue["Image"]["WebPath"];
}
}
echo ' <h4>'.$aValue["Headline"].'</h4>', chr(10);
#Get dimensions of the image
list ($width, $height, $type, $attr) = getimagesize($image);
if ($image != "") {
echo ' <img src="'.$image.'" width="'.$width.'" height="'.$height.'" />', chr(10);
}
echo $aValue["Text"].'<br /><br /><a href="'.$aValue["Link"].'">'.mi18n("More...").'</a><p></p><br />', chr(10);
}
}
}
unset ($aData);
unset ($aSettings);
?>
Habe lediglich die Kürzungen rausgenommen, so dass der Textbereich komplett wie im Originalartikel erscheint.
Hoffe, das hilft jemandem. Und große Verneigung vor HerrB für das super Modul.
Gruß,
Silicone