Hallo zusammen,
ich hatte das Problem, dass meine Artikelliste den Text aus den Artikeln mit HTML-Tags übernehmen sollte. Das habe ich gelöst bekommen und in der Konfiguration des Moduls zugänglich gemacht. Bitte schaut mal drüber, bei mir funzt es und ich bin ganz stolz drauf.
http://www.schwestern-undbruederschaft.de u.a. auf der Startseite. Meine Änderungen im Modul habe ich mit "Thomas Hempel" gekennzeichnet:
Code: Alles auswählen
#INPUT
#Includes
cInclude("frontend", "includes/functions.input.helper.php");
# Initialization
$bDebug = false;
$iDataStart = 20;
$sSubmitLink = '<a href="javascript:if (document.tplcfgform.send) {document.tplcfgform.send.value = 0}; document.tplcfgform.submit();"><img src="images/submit.gif" /></a>';
unset ($aSettings);
# Base settings
$aSettings = array();
$aSettings["ArticleCount"] = "CMS_VALUE[0]";
$aSettings["ArticlePerPage"] = "CMS_VALUE[1]";
$aSettings["SortBy"] = "CMS_VALUE[2]";
$aSettings["SortDir"] = "CMS_VALUE[3]";
$aSettings["ShowStart"] = "CMS_VALUE[4]";
$aSettings["Category"] = "CMS_VALUE[5]";
$aSettings["SampleCat"] = "CMS_VALUE[12]";
$aSettings["SampleArt"] = "CMS_VALUE[6]";
$aSettings["HeadlineIdentifier"] = "CMS_VALUE[7]";
$aSettings["HeadlineLength"] = "CMS_VALUE[8]";
$aSettings["Elements"] = "CMS_VALUE[9]";
$aSettings["CatTypeSel"] = "CMS_VALUE[10]";
$aSettings["AddCats"] = "CMS_VALUE[11]";
# Checking base settings
if (!is_numeric($aSettings["ArticleCount"]) || $aSettings["ArticleCount"] < 0) {
$aSettings["ArticleCount"] = 5;
}
if (!is_numeric($aSettings["ArticlePerPage"]) || $aSettings["ArticlePerPage"] < 0) {
$aSettings["ArticlePerPage"] = 0; // Deactivating page browsing
}
if (!is_numeric($aSettings["Category"]) || $aSettings["Category"] <= 0) {
$aSettings["Category"] = 0;
}
if (!is_numeric($aSettings["SampleCat"]) || $aSettings["SampleCat"] <= 0) {
$aSettings["SampleCat"] = $aSettings["Category"];
}
if (!is_numeric($aSettings["SampleArt"]) || $aSettings["SampleArt"] < 0) {
$aSettings["SampleArt"] = 0;
}
if (strlen($aSettings["HeadlineIdentifier"]) > 50) {
$aSettings["HeadlineIdentifier"] = "";
}
if (!is_numeric($aSettings["HeadlineLength"]) || $aSettings["HeadlineLength"] < 0) {
$aSettings["HeadlineLength"] = 0;
}
if (!is_numeric($aSettings["Elements"]) || $aSettings["Elements"] < 0) {
$aSettings["Elements"] = 0;
}
if ($aSettings["CatTypeSel"] == "" || ($aSettings["AddCats"] == "" && $aSettings["CatTypeSel"] == "selected")) {
$aSettings["CatTypeSel"] = "none";
}
# Detail settings
if ($aSettings["Elements"] > 0) {
for ($i = 0; $i < $aSettings["Elements"]; $i++) {
$iElementType = $iDataStart + ($i * 5);
$iElementIdentifier = $iElementType + 1;
$iElementWidth = $iElementType + 2;
$iElementHeight = $iElementType + 3;
$iElementTags = $iElementType + 4; //Thomas Hempel
$aSettings["k".$i] = array();
$aSettings["k".$i]["ElementType"] = "CMS_VALUE[$iElementType]"; // Text, Image, ExtractedImage
$aSettings["k".$i]["Identifier"] = "CMS_VALUE[$iElementIdentifier]";
$aSettings["k".$i]["ElementWidth"] = "CMS_VALUE[$iElementWidth]"; // Textlength or ImageWidth
$aSettings["k".$i]["ElementHeight"] = "CMS_VALUE[$iElementHeight]";
$aSettings["k".$i]["ElementTags"] = "CMS_VALUE[$iElementTags]"; /* Thomas Hempel: allowed Tags*/
# Check detail settings
if ($aSettings["k".$i]["ElementType"] == "") {
$aSettings["k".$i]["ElementType"] == "Text";
}
if ($aSettings["k".$i]["ElementType"] == "Text") {
$aSettings["ElementHeight"] = 0;
if (!is_numeric($aSettings["k".$i]["ElementWidth"]) || $aSettings["k".$i]["ElementWidth"] < 0) {
$aSettings["k".$i]["ElementWidth"] = 50;
}
} else if (!is_numeric($aSettings["k".$i]["ElementWidth"]) || $aSettings["k".$i]["ElementWidth"] <= 0 ||
!is_numeric($aSettings["k".$i]["ElementHeight"]) || $aSettings["k".$i]["ElementHeight"] <= 0) {
$aSettings["k".$i]["ElementWidth"] = 0;
$aSettings["k".$i]["ElementHeight"] = 0;
}
if (strlen($aSettings["Identifier"]) > 50) {
$aSettings["Identifier"] = "";
}
}
}
echo ' <table cellspacing="0" cellpadding="2" border="0" width="100%">'."\n";
echo ' <tr>'."\n";
echo ' <td class="text">'.mi18n("Primary Category:").'</td>'."\n";
echo ' <td class="text">'.fncBuildCategorySelect("CMS_VAR[5]", $aSettings["Category"], 0, "").'</td>'."\n";
echo ' </tr>'."\n";
echo ' <tr>'."\n";
echo ' <td class="text" style="vertical-align: top;">'.mi18n("Additional Categories:").'</td>'."\n";
echo ' <td class="text">';
if ($aSettings["CatTypeSel"] == "none") {
echo '<input type="radio" name="CMS_VAR[10]" value="none" checked="checked" onclick="document.getElementsByName(\'c'.$cnumber.'cbxAddCatSel\')[0].disabled = true;">'.mi18n("None").' ';
} else {
echo '<input type="radio" name="CMS_VAR[10]" value="none" onclick="document.getElementsByName(\'c'.$cnumber.'cbxAddCatSel\')[0].disabled = true;">'.mi18n("None").' ';
}
if ($aSettings["CatTypeSel"] == "below") {
echo '<input type="radio" name="CMS_VAR[10]" value="below" checked="checked" onclick="document.getElementsByName(\'c'.$cnumber.'cbxAddCatSel\')[0].disabled = true;">'.mi18n("All below primary").' ';
} else {
echo '<input type="radio" name="CMS_VAR[10]" value="below" onclick="document.getElementsByName(\'c'.$cnumber.'cbxAddCatSel\')[0].disabled = true;">'.mi18n("All below primary").' ';
}
if ($aSettings["CatTypeSel"] == "selected") {
$sDisabled = "";
echo '<input type="radio" name="CMS_VAR[10]" value="selected" checked="checked" onclick="document.getElementsByName(\'c'.$cnumber.'cbxAddCatSel\')[0].disabled = false;">'.mi18n("Selected").'<br>';
} else {
$sDisabled = "disabled";
echo '<input type="radio" name="CMS_VAR[10]" value="selected" onclick="document.getElementsByName(\'c'.$cnumber.'cbxAddCatSel\')[0].disabled = false;">'.mi18n("Selected").'<br>';
}
echo fncAddMultiSelJS().fncBuildCategorySelect("c".$cnumber."cbxAddCatSel", $aSettings["AddCats"], 0, "fncUpdateSel('c".$cnumber."cbxAddCatSel', '"."CMS_VAR[11]"."');", "10", "multiple", false, 0, $sDisabled);
echo '<input type="hidden" name="CMS_VAR[11]" value="'.$aSettings["AddCats"].'"></td>'."\n";
echo ' </tr>'."\n";
echo ' <tr>'."\n";
echo ' <td class="text">'.mi18n("Article:").'</td>'."\n";
echo ' <td class="text">'.mi18n("Count (total):").' <input type="text" name="CMS_VAR[0]" value="'.$aSettings["ArticleCount"].'" size="3" title="'.mi18n("Set to 0 to show all articles").'"> '."\n";
echo ' '.mi18n("Per Page:").' <input type="text" name="CMS_VAR[1]" value="'.$aSettings["ArticlePerPage"].'" size="3" title="'.mi18n("Set to 0 to disable page browsing").'"></td>'."\n";
echo ' </tr>'."\n";
echo ' <tr>'."\n";
echo ' <td class="text">'.mi18n("Sort by:").'</td>'."\n";
echo ' <td class="text"><select name="CMS_VAR[2]">'."\n";
if ($aSettings["SortBy"] == "" || $aSettings["SortBy"] == "CATART.idart") {
echo ' <option value="CATART.idart" selected>'.mi18n("Article ID").'</option>'."\n";
} else {
echo ' <option value="CATART.idart">'.mi18n("Article ID").'</option>'."\n";
}
if ($aSettings["SortBy"] == "tblData.value") {
echo ' <option value="tblData.value" selected>'.mi18n("Headline").'</option>'."\n";
} else {
echo ' <option value="tblData.value">'.mi18n("Headline").'</option>'."\n";
}
if ($aSettings["SortBy"] == "ARTLANG.created") {
echo ' <option value="ARTLANG.created" selected>'.mi18n("Add Date").'</option>'."\n";
} else {
echo ' <option value="ARTLANG.created">'.mi18n("Add Date").'</option>'."\n";
}
if ($aSettings["SortBy"] == "ARTLANG.lastmodified") {
echo ' <option value="ARTLANG.lastmodified" selected>'.mi18n("Last Modified Date").'</option>'."\n";
} else {
echo ' <option value="ARTLANG.lastmodified">'.mi18n("Last Modified Date").'</option>'."\n";
}
if ($aSettings["SortBy"] == "ARTLANG.published") {
echo ' <option value="ARTLANG.published" selected>'.mi18n("Published Date").'</option>'."\n";
} else {
echo ' <option value="ARTLANG.published">'.mi18n("Published Date").'</option>'."\n";
}
if ($aSettings["SortBy"] == "ARTLANG.title") {
echo ' <option value="ARTLANG.title" selected>'.mi18n("Page Title (Backend)").'</option>'."\n";
} else {
echo ' <option value="ARTLANG.title">'.mi18n("Page Title (Backend)").'</option>'."\n";
}
if ($aSettings["SortBy"] == "ARTLANG.pagetitle") {
echo ' <option value="ARTLANG.pagetitle" selected>'.mi18n("Page Title (Frontend)").'</option>'."\n";
} else {
echo ' <option value="ARTLANG.pagetitle">'.mi18n("Page Title (Frontend)").'</option>'."\n";
}
if ($aSettings["SortBy"] == "ARTLANG.summary") {
echo ' <option value="ARTLANG.summary" selected>'.mi18n("Summary (Backend)").'</option>'."\n";
} else {
echo ' <option value="ARTLANG.summary">'.mi18n("Summary (Backend)").'</option>'."\n";
}
if ($aSettings["SortBy"] == "ARTLANG.artsort") {
echo ' <option value="ARTLANG.artsort" selected>'.mi18n("Sort No.").'</option>'."\n";
} else {
echo ' <option value="ARTLANG.artsort">'.mi18n("Sort No.").'</option>'."\n";
}
if ($aSettings["SortBy"] == "RAND()") {
echo ' <option value="RAND()" selected>'.mi18n("Random").'</option>'."\n";
} else {
echo ' <option value="RAND()">'.mi18n("Random").'</option>'."\n";
}
echo ' </select>'."\n";
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")."\n";
} 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")."\n";
}
echo ' </tr>'."\n";
echo ' <tr>'."\n";
echo ' <td class="text">'.mi18n("Start Article:").'</td>'."\n";
if ($aSettings["ShowStart"] != "enabled") {
echo ' <td class="text"><input type="checkbox" name="CMS_VAR[4]" value="enabled">'.mi18n("Show").'</td>'."\n";
} else {
echo ' <td class="text"><input type="checkbox" name="CMS_VAR[4]" value="enabled" checked>'.mi18n("Show").'</td>'."\n";
}
echo ' </tr>'."\n";
echo ' </table>'."\n";
echo ' <table cellspacing="0" cellpadding="2" border="0" width="100%">'."\n";
echo ' <tr>'."\n";
echo ' <td colspan="2" class="textw_medium" style="background-color: #a9aec2; border: 1px solid #747488;">'.mi18n("Identify elements:").'</td>'."\n";
echo ' </tr>'."\n";
echo ' <tr>'."\n";
echo ' <td class="text" style="border-left: 1px solid #747488;">'.mi18n("Sample Category:").'</td>'."\n";
echo ' <td class="text" style="border-right: 1px solid #747488;">'.fncBuildCategorySelect("CMS_VAR[12]", $aSettings["SampleCat"], 0, "if (document.forms[0].elements['CMS_VAR[12]'].value != 'CMS_VALUE[12]') { 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;}").' '.$sSubmitLink.'</td>'."\n";
echo ' </tr>'."\n";
echo ' <tr>'."\n";
echo ' <td class="text" style="border-left: 1px solid #747488;">'.mi18n("Sample Article:").'</td>'."\n";
if ($aSettings["SampleCat"] == 0) {
$sDisabled = "disabled";
} else {
$sDisabled = "";
}
echo ' <td class="text" style="border-right: 1px solid #747488;">'.fncBuildArticleSelect("CMS_VAR[6]", $aSettings["SampleCat"], $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;}", $sDisabled).' '.$sSubmitLink.'</td>'."\n";
echo ' </tr>'."\n";
echo ' <tr>'."\n";
echo ' <td class="text" style="border-left: 1px solid #747488;">'.mi18n("Headline Element:").'</td>'."\n";
echo ' <td class="text" style="border-right: 1px solid #747488;">'.fncBuildTypeSelect("CMS_VAR[7]", $aSettings["SampleArt"], $aSettings["HeadlineIdentifier"], "'1','2','3','9','17'").' '.mi18n("Length (max.):").' <input type="text" name="'."CMS_VAR[8]".'" value="'.$aSettings["HeadlineLength"].'" size="3" title="'.mi18n("Set to 0 to show all").'"></td>'."\n";
echo ' </tr>'."\n";
if ($aSettings["Elements"] == 0) {
$sBottomStyle = "border-bottom: 1px solid #747488;"; // Paint the table area closing line
} else {
$sBottomStyle = "";
}
echo ' <tr>'."\n";
echo ' <td class="text" style="border-left: 1px solid #747488;'.$sBottomStyle.'">'.mi18n("Additional elements:").'</td>'."\n";
echo ' <td class="text" style="border-right: 1px solid #747488;'.$sBottomStyle.'"><input type="text" name="CMS_VAR[9]" value="'.$aSettings["Elements"].'" size="3" title="'.mi18n("Set to a value above 0 to specify text or images as additional elements").'"> '.$sSubmitLink.'</td>'."\n";
echo ' </tr>'."\n";
if ($aSettings["Elements"] > 0) {
for ($i = 0; $i < $aSettings["Elements"]; $i++) {
$iElementType = $iDataStart + ($i * 5);
$iElementIdentifier = $iElementType + 1;
$iElementWidth = $iElementType + 2;
$iElementHeight = $iElementType + 3;
$iElementTags = $iElementType + 4; //Thomas Hempel
echo ' <tr>'."\n";
echo ' <td class="text" style="border-left: 1px solid #747488;padding-left: 20px;vertical-align: top;">'.sprintf(mi18n("%s. Element:"), $i + 1).'</td>'."\n";
echo ' <td class="text" style="border-right: 1px solid #747488;">'.mi18n("Type:").'<br />'."\n";
echo ' <select name="'."CMS_VAR[$iElementType]".'" onchange="if (document.forms[0].elements[\''."CMS_VAR[$iElementType]".'\'].value != \''.$aSettings["k".$i]["ElementType"].'\') { document.forms[0].elements[\''."CMS_VAR[$iElementIdentifier]".'\'].disabled = true; document.forms[0].elements[\''."CMS_VAR[$iElementWidth]".'\'].disabled = true; if (document.forms[0].elements[\''."CMS_VAR[$iElementHeight]".'\']) {document.forms[0].elements[\''."CMS_VAR[$iElementHeight]".'\'].disabled = true;}} else { document.forms[0].elements[\''."CMS_VAR[$iElementIdentifier]".'\'].disabled = false; document.forms[0].elements[\''."CMS_VAR[$iElementWidth]".'\'].disabled = false; if (document.forms[0].elements[\''."CMS_VAR[$iElementHeight]".'\']) {document.forms[0].elements[\''."CMS_VAR[$iElementHeight]".'\'].disabled = false;}}"">'."\n";
if ($aSettings["k".$i]["ElementType"] == "Text") {
echo ' <option value="Text" selected="selected">'.mi18n("Text").'</option>'."\n";
} else {
echo ' <option value="Text">'.mi18n("Text").'</option>'."\n";
}
if ($aSettings["k".$i]["ElementType"] == "Image") {
echo ' <option value="Image" selected="selected">'.mi18n("Image").'</option>'."\n";
} else {
echo ' <option value="Image">'.mi18n("Image").'</option>'."\n";
}
if ($aSettings["k".$i]["ElementType"] == "ExtractedImage") {
echo ' <option value="ExtractedImage" selected="selected">'.mi18n("Image from text").'</option>'."\n";
} else {
echo ' <option value="ExtractedImage">'.mi18n("Image from text").'</option>'."\n";
}
echo ' </select> '.$sSubmitLink.' '."\n";
echo ' </td>'."\n";
echo ' </tr>'."\n";
if ($i == ($aSettings["Elements"] - 1)) {
$sBottomStyle = "border-bottom: 1px solid #747488;"; // Paint the table area closing line
} else {
$sBottomStyle = "";
}
echo ' <tr>'."\n";
switch ($aSettings["k".$i]["ElementType"]) {
case "Image":
echo ' <td class="text" style="border-left: 1px solid #747488;'.$sBottomStyle.'padding-left: 20px;"> </td>'."\n";
echo ' <td class="text" style="border-right: 1px solid #747488;'.$sBottomStyle.'">'.mi18n("Item:").'<br />'.fncBuildTypeSelect("CMS_VAR[$iElementIdentifier]", $aSettings["SampleArt"], $aSettings["k".$i]["Identifier"], "'4'").' '."\n";
echo ' '.mi18n("Width:"). ' <input type="text" name="'."CMS_VAR[$iElementWidth]".'" value="'.$aSettings["k".$i]["ElementWidth"].'" size="4" title="'.mi18n("Set to 0 to disable resize").'"> '."\n";
echo ' '.mi18n("Height:").' <input type="text" name="'."CMS_VAR[$iElementHeight]".'" value="'.$aSettings["k".$i]["ElementHeight"].'" size="4" title="'.mi18n("Set to 0 to disable resize").'"></td>'."\n";
break;
case "ExtractedImage":
echo ' <td class="text" style="border-left: 1px solid #747488;'.$sBottomStyle.'padding-left: 20px;"> </td>'."\n";
echo ' <td class="text" style="border-right: 1px solid #747488;'.$sBottomStyle.'">'.mi18n("Item:").'<br />'.fncBuildTypeSelect("CMS_VAR[$iElementIdentifier]", $aSettings["SampleArt"], $aSettings["k".$i]["Identifier"], "'1','2','3','9','17'").' '."\n";
echo ' '.mi18n("Width:"). ' <input type="text" name="'."CMS_VAR[$iElementWidth]".'" value="'.$aSettings["k".$i]["ElementWidth"].'" size="4" title="'.mi18n("Set to 0 to disable resize").'"> '."\n";
echo ' '.mi18n("Height:").' <input type="text" name="'."CMS_VAR[$iElementHeight]".'" value="'.$aSettings["k".$i]["ElementHeight"].'" size="4" title="'.mi18n("Set to 0 to disable resize").'"></td>'."\n";
break;
default:
echo ' <td class="text" style="border-left: 1px solid #747488;'.$sBottomStyle.'padding-left: 20px;"> </td>'."\n";
echo ' <td class="text" style="border-right: 1px solid #747488;'.$sBottomStyle.'">'.mi18n("Item:").'<br />'.fncBuildTypeSelect("CMS_VAR[$iElementIdentifier]", $aSettings["SampleArt"], $aSettings["k".$i]["Identifier"], "'1','2','3','9','17'").' '."\n";
# original: echo ' '.mi18n("Length (max.):").' <input type="text" name="'."CMS_VAR[$iElementWidth]".'" value="'.$aSettings["k".$i]["ElementWidth"].'" size="3" title="'.mi18n("Set to 0 to show all").'"></td>'."\n";
#Thomas Hempel:
echo ' '.mi18n("Length (max.):").' <input type="text" name="'."CMS_VAR[$iElementWidth]".'" value="'.$aSettings["k".$i]["ElementWidth"].'" size="3" title="'.mi18n("Set to 0 to show all").'">'."\n";
echo ' '.mi18n("allowed Tags:").' <input type="text" name="'."CMS_VAR[$iElementTags]".'" value="'.$aSettings["k".$i]["ElementTags"].'" size="20" title="'.mi18n("allowed HTML-Tags like <p>").'"></td>'."\n";
}
echo ' </tr>'."\n";
}
}
echo ' </table>'."\n";
Code: Alles auswählen
#OUTPUT
<?php
# Initialization
$bDebug = false;
$iDataStart = 20;
$lCount = 0;
unset ($aData);
$aData = array();
# Base settings
unset ($aSettings);
$aSettings = array();
$aSettings["ArticleCount"] = "CMS_VALUE[0]";
$aSettings["ArticlePerPage"] = "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["HeadlineLength"] = "CMS_VALUE[8]";
$aSettings["Elements"] = "CMS_VALUE[9]";
$aSettings["CatTypeSel"] = "CMS_VALUE[10]";
$aSettings["AddCats"] = "CMS_VALUE[11]";
# Checking base settings
if (!is_numeric($aSettings["ArticleCount"]) || $aSettings["ArticleCount"] < 0) {
$aSettings["ArticleCount"] = 5;
}
if (!is_numeric($aSettings["ArticlePerPage"]) || $aSettings["ArticlePerPage"] < 0) {
$aSettings["ArticlePerPage"] = 0; // Deactivating page browsing
}
if ($aSettings["ArticlePerPage"] == 0 || !is_numeric($_REQUEST["nextstep"])) {
$_REQUEST["nextstep"] = 0;
}
if (!is_numeric($aSettings["Category"]) || $aSettings["Category"] <= 0) {
$aSettings["Category"] = 0;
}
if (strlen($aSettings["HeadlineIdentifier"]) > 50) {
$aSettings["HeadlineIdentifier"] = "";
}
if (!is_numeric($aSettings["HeadlineLength"]) || $aSettings["HeadlineLength"] < 0) {
$aSettings["HeadlineLength"] = 0;
}
if (!is_numeric($aSettings["Elements"]) || $aSettings["Elements"] < 0) {
$aSettings["Elements"] = 0;
}
if ($aSettings["CatTypeSel"] == "" || ($aSettings["AddCats"] == "" && $aSettings["CatTypeSel"] == "selected")) {
$aSettings["CatTypeSel"] = "none";
}
# Detail settings
if ($aSettings["Elements"] > 0) {
for ($i = 0; $i < $aSettings["Elements"]; $i++) {
$iElementType = $iDataStart + ($i * 5);
$iElementIdentifier = $iElementType + 1;
$iElementWidth = $iElementType + 2;
$iElementHeight = $iElementType + 3;
$iElementTags = $iElementType + 4; //Thomas Hempel
$aSettings["k".$i] = array();
$aSettings["k".$i]["ElementType"] = "CMS_VALUE[$iElementType]"; // Text, Image, ExtractedImage
$aSettings["k".$i]["Identifier"] = "CMS_VALUE[$iElementIdentifier]";
$aSettings["k".$i]["ElementWidth"] = "CMS_VALUE[$iElementWidth]"; // Textlength or ImageWidth
$aSettings["k".$i]["ElementHeight"] = "CMS_VALUE[$iElementHeight]";
$aSettings["k".$i]["ElementTags"] = "CMS_VALUE[$iElementTags]"; //Thomas Hempel: allowed Tags
# Check detail settings
if ($aSettings["k".$i]["ElementType"] == "") {
$aSettings["k".$i]["ElementType"] == "Text";
}
if ($aSettings["k".$i]["ElementType"] == "Text") {
$aSettings["ElementHeight"] = 0;
if (!is_numeric($aSettings["k".$i]["ElementWidth"]) || $aSettings["k".$i]["ElementWidth"] < 0) {
$aSettings["k".$i]["ElementWidth"] = 50;
}
} else if (!is_numeric($aSettings["k".$i]["ElementWidth"]) || $aSettings["k".$i]["ElementWidth"] <= 0 ||
!is_numeric($aSettings["k".$i]["ElementHeight"]) || $aSettings["k".$i]["ElementHeight"] <= 0) {
$aSettings["k".$i]["ElementWidth"] = 0;
$aSettings["k".$i]["ElementHeight"] = 0;
}
if (strlen($aSettings["Identifier"]) > 50) {
$aSettings["Identifier"] = "";
}
}
}
unset ($iDataStart);
unset ($iElementType);
unset ($iElementIdentifier);
unset ($iElementWidth);
unset ($iElementHeight);
unset ($iElementTags); //Thomas Hempel
//hier gekürzt...
// execute query
if ($sql != "") {
$db4->query($sql);
if ($db4->next_record()) {
$aData[$i]["i".$k]["ServerPath"] = $cfgClient[$client]["upl"]["path"].$db4->f('dirname').$db4->f('filename');
$aData[$i]["i".$k]["WebPath"] = $cfgClient[$client]["upl"]["htmlpath"].$db4->f('dirname').$db4->f('filename');
list ($width, $height, $type, $attr) = getimagesize($aData[$i]["i".$k]["WebPath"]);
$aData[$i]["i".$k]["Width"] = $width;
$aData[$i]["i".$k]["Height"] = $height;
}
}
break;
default:
#$sTmpValue = html_entity_decode(strip_tags(urldecode($db3->f('value'))));
#Thomas Hempel get more with: strip_tags ( string $str [, string $allowable_tags] )
$sTmpValue = html_entity_decode(strip_tags(urldecode($db3->f('value')), $aSettings["k".$k]["ElementTags"]));
if ($aSettings["k".$k]["ElementWidth"] > 0 && strlen($sTmpValue) > $aSettings["k".$k]["ElementWidth"]) {
# Cutting text but preserving words and entities
#$sTmpValue = htmlentities(capiStrTrimAfterWord($sTmpValue, $aSettings["k".$k]["ElementWidth"])."...");
$sTmpValue = capiStrTrimAfterWord($sTmpValue, $aSettings["k".$k]["ElementWidth"])."...";
}
$aData[$i]["i".$k]["Value"] = $sTmpValue;
}
}
}
}
}
$i++;
} else if ($lRow == $lEndCount) {
break;
}
$lRow++;
}
}
# Clearing memory
unset ($db2);
unset ($db3);
unset ($db4);
unset ($sql);
unset ($lStartIDArtLang);
unset ($lStartCount);
unset ($lEndCount);
# Output data
# Every output manipulation should be done here...
#
# Base information:
# $aSettings["Elements"]: Number of expected, additional elements from each article
# $aSettings["ArticlePerPage"]: Number of articles per page (0: show all)
# $aSettings["k".$i]["ElementType"]: Per Element: Type of Element: Text, Image or ExtractedImage
# $aSettings["k".$i]["ElementWidth"]: Per Element: Text length or image width (-> recycling ...)
# $aSettings["k".$i]["ElementHeight"]: Per Element: Image width
#
# Per article:
# $aValue["Headline"]: Content of article element specified as containing the headline information
# $aValue["Link"]: Relative link to get to the listed article
# $aValue["LastModified"]: Last modified date of the article
# $aValue["Created"]: Created date of the article
# $aValue["Published"]: Published date of the article
# $aValue["Category"]: Category name
#
# Per article additional element:
# $aValue["i".$i]["Value"]: Text (only for text elements, otherwise "")
$aValue["i".$i]["Value"] = preg_replace ( '/ndash;/', '#8211;', $aValue["i".$i]["Value"]);
# $aValue["i".$i]["WebPath"]: HTTP... path to image
# $aValue["i".$i]["ServerPath"]: /server/... path to image
# $aValue["i".$i]["Width"]: >Original< image width
# $aValue["i".$i]["Height"]: >Original< image height
foreach ($aData as $aValue) {
echo '<div>', chr(10);
#echo ' <div id="headline">'.$aValue["Category"].": ".$aValue["Headline"].'</div>', chr(10);
echo ' <div id="headline">'.$aValue["Headline"].'</div>', chr(10);
if ($aSettings["Elements"] > 0) {
for ($i = 0; $i < $aSettings["Elements"]; $i++) {
switch (TRUE) {
case ($aSettings["k".$i]["ElementType"] == "Image" || $aSettings["k".$i]["ElementType"] == "ExtractedImage"):
$image = $aValue["i".$i]["WebPath"];
$width = $aValue["i".$i]["Width"];
$height = $aValue["i".$i]["Height"];
if ($aSettings["k".$i]["ElementWidth"] > 0 && $aSettings["k".$i]["ElementHeight"] > 0) {
# Check, if resize necessary
if ($aValue["i".$i]["ServerPath"] != "" && file_exists($aValue["i".$i]["ServerPath"]) &&
($aValue["i".$i]["Width"] > $aSettings["k".$i]["ElementWidth"] ||
$aValue["i".$i]["Height"] > $aSettings["k".$i]["ElementHeight"])) {
# Scale image
$image = capiImgScale($aValue["i".$i]["ServerPath"], $aSettings["k".$i]["ElementWidth"], $aSettings["k".$i]["ElementHeight"], false, false, 10, false);
#Get dimensions of the image
list ($width, $height, $type, $attr) = getimagesize($image);
} else {
$image = $aValue["i".$i]["WebPath"];
$width = $aValue["i".$i]["Width"];
$height = $aValue["i".$i]["Height"];
}
}
if ($image != "") {
echo ' <div id="image"><img src="'.$image.'" width="'.$width.'" height="'.$height.'" /></div>', chr(10);
}
break;
default: // Everything else is treated as "Text"
echo ' <div id="text">'.$aValue["i".$i]["Value"].'</div>', chr(10);
}
}
}
echo '<a href="'.$aValue["Link"].'">'.mi18n("More...").'</a>', chr(10);
echo '<div id="clearfooter"></div>';
echo '</div>', chr(10);
}
}
# Page browsing
# Hint: Number of max available records: $lCount
# Number of pages: round($lCount / $aSettings["ArticlePerPage"])
# First page: nextstep=0
# Last page: nextstep=(round($lCount / $aSettings["ArticlePerPage"]) - 1) * $aSettings["ArticlePerPage"];
# (I have to admit that I'm not sure about the last page formula ... ;-) )
if ($aSettings["ArticlePerPage"] > 0) {
# Example: Back and Next
echo '<div id="browsing">', chr(10);
if ($_REQUEST["nextstep"] > 0) {
echo ' <div id="Back">', chr(10);
echo ' <a href="front_content.php?idcat='.$idcat.'&idart='.$idart.'&nextstep='.($_REQUEST["nextstep"]-$aSettings["ArticlePerPage"]).'">'.mi18n("Back").'</a>', chr(10);
echo ' </div>', chr(10);
}
if (($_REQUEST["nextstep"] + $aSettings["ArticlePerPage"]) < $lCount) {
echo ' <div id="Next">', chr(10);
echo ' <a href="front_content.php?idcat='.$idcat.'&idart='.$idart.'&nextstep='.($_REQUEST["nextstep"]+$aSettings["ArticlePerPage"]).'">'.mi18n("Next").'</a>', chr(10);
echo ' </div>', chr(10);
}
# Example: 1 2 3 4 5 6 7 ...
$iPages = intval($lCount / $aSettings["ArticlePerPage"]);
$sPageLinks = '';
echo ' <div id="Pages">';
for ($i = 1; $i <= $iPages; $i++) {
$lNextStep = ($i - 1) * $aSettings["ArticlePerPage"];
if ($sPageLinks != '') {
$sPageLinks .= ' ';
}
if ($_REQUEST["nextstep"] == $lNextStep) {
$sPageLinks .= $i."\n"; # I'm on the current page, no link
} else {
$sPageLinks .= '<a href="front_content.php?idcat='.$idcat.'&idart='.$idart.'&nextstep='.$lNextStep.'">'.$i.'</a>'."\n";
}
}
echo ' '.$sPageLinks."\n";
echo ' </div>'."\n";
# Example: |< 1 ... 3 4 5 ... 8 >|
$iPages = intval($lCount / $aSettings["ArticlePerPage"]);
$sPageLinks = '';
echo ' <div id="Pages">'."\n";
echo ' <a href="front_content.php?idcat='.$idcat.'&idart='.$idart.'&nextstep=0">|<</a>'."\n";
for ($i = 1; $i <= $iPages; $i++) {
$lNextStep = ($i - 1) * $aSettings["ArticlePerPage"];
if ($i == 1 || $i == $iPages) {
if ($sPageLinks != '') {
$sPageLinks .= ' ';
}
if ($_REQUEST["nextstep"] == $lNextStep) {
$sPageLinks .= $i."\n"; # I'm on the current page, no link
} else {
$sPageLinks .= '<a href="front_content.php?idcat='.$idcat.'&idart='.$idart.'&nextstep='.$lNextStep.'">'.$i.'</a>'."\n";
}
} else if ($_REQUEST["nextstep"] == $lNextStep) {
$sPageLinks .= ' '.$i."\n"; # I'm on the current page, no link
} else if ($_REQUEST["nextstep"] == ($lNextStep + $aSettings["ArticlePerPage"])) {
# Front
$sPageLinks .= ' <a href="front_content.php?idcat='.$idcat.'&idart='.$idart.'&nextstep='.$lNextStep.'">'.$i.'</a>'."\n";
} else if ($_REQUEST["nextstep"] == ($lNextStep - $aSettings["ArticlePerPage"])) {
# Back
$sPageLinks .= ' <a href="front_content.php?idcat='.$idcat.'&idart='.$idart.'&nextstep='.$lNextStep.'">'.$i.'</a>'."\n";
} else if ($_REQUEST["nextstep"] == ($lNextStep - (2 * $aSettings["ArticlePerPage"])) ||
$_REQUEST["nextstep"] == ($lNextStep + (2 * $aSettings["ArticlePerPage"]))) {
$sPageLinks .= '...';
}
}
echo ' '.$sPageLinks."\n";
echo ' <a href="front_content.php?idcat='.$idcat.'&idart='.$idart.'&nextstep='.(round($lCount / $aSettings["ArticlePerPage"]) - 1) * $aSettings["ArticlePerPage"].'">>|</a>'."\n";
echo ' </div>'."\n";
echo '</div>'."\n"; # Closing Browsing div
}
}
# Clearing memory
unset ($aData);
unset ($aSettings);
unset ($i);
unset ($lCount);
unset ($bDebug);
?>
Eine Idee fehlt mir noch: Wenn im Content Tabellen enthalten sind, werden diese zerschnitten und zerstören das Gesamtlayout. Hat jemand eine Funktino, die die zerschnittenen Tabellen-Tags validiert und repariert? Alternativ wäre es vielleicht möglich, immer nur eine Tabelle im ganzen rauszuschneiden. Kann da vllt jemand helfen?
Gruß
Thomas