ich möchte die Ausgabe der Standard-Artikelliste Advanced V1.0 von HerrB (besten Dank an dieser Stelle) formatieren und stehe vor einem mir nicht erklärlichen Problem

Ich möchte gerne die Ausgabe 3 spaltig und das Ganze dann von einem Rahmen umgeben, nomalerweise löse ich das mit geschachteltet divs und float
Das funktioniert auch prima, in der Regel


beispiel:
eigentlich sollte der gelbe div von den gefloateten divs nach unten gespreizt/aufgezogen werden (wie oben der gelbe bereich), tuts aber nicht

hier mal der relevante output zum gucken mit kommentaren versehen
(anmerkung: sebstverständlich wird da vieles dann abschliessend in's css ausgelagert)
frage warum greifen
mainwrap (blau)
wrap1 (braun)
wrap2 (gelb)
wrap3 (rot)
der wrap 4 setzt zwar richtig an, spreizt/dehnt dann aber den wrap3 nicht nach unten

Code: Alles auswählen
<?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]";
# 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;
}
# 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;
$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]";
# 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);
if ($aSettings["Category"] !== "0" && $aSettings["HeadlineIdentifier"] !== "") {
if (!is_object($db2)) {
$db2 = new DB_Contenido;
}
# Identifying start article, if necessary
$lStartIDArtLang = 0;
if ($aSettings["ShowStart"] != "enabled") {
if ($cfg["is_start_compatible"] == true) {
$sql = "SELECT tblArtLang.idartlang AS startidartlang FROM ".$cfg["tab"]["art_lang"]." tblArtLang, ";
$sql .= $cfg["tab"]["cat_art"]." tblCatArt ";
$sql .= "WHERE tblCatArt.is_start = '1' AND tblCatArt.idcat='".$aSettings["Category"]."' ";
$sql .= "AND tblCatArt.idart = tblArtLang.idart AND tblArtLang.idlang = '".$lang."'";
} else {
$sql = "SELECT startidartlang FROM ".$cfg["tab"]["cat_lang"]." tblCatLang ";
$sql .= "WHERE idcat='".$aSettings["Category"]."' AND idlang='".$lang."'";
}
$db2->query($sql);
if ($db2->next_record()) {
$lStartIDArtLang = $db2->f("startidartlang");
}
}
$sql = "SELECT tblData.value AS headline, ARTLANG.idart AS id, ARTLANG.lastmodified AS lastmodified, " ;
$sql .= "ARTLANG.idartlang AS idartlang, CATART.idcat AS idcat, CATART.idcatart AS idcatart FROM ";
$sql .= $cfg["tab"]["cat_art"]." AS CATART, ";
$sql .= $cfg["tab"]["art_lang"]." AS ARTLANG, ";
$sql .= $cfg["tab"]["cat_lang"]." AS CATLANG, ";
$sql .= $cfg["tab"]["content"]." AS tblData ";
$sql .= "WHERE CATART.idcat = '".$aSettings["Category"]."' AND ARTLANG.idlang = '".$lang."' ";
$sql .= "AND tblData.idartlang = ARTLANG.idartlang ";
$sql .= "AND CATLANG.idlang = ARTLANG.idlang ";
$sql .= "AND CATLANG.idcat = CATART.idcat ";
$sql .= "AND ARTLANG.idart = CATART.idart ";
$sql .= "AND ARTLANG.online = '1' ";
$sql .= "AND ".$aSettings["HeadlineIdentifier"]." ";
// Sort by
$sql .= "ORDER BY ";
$sql .= $aSettings["SortBy"]." ".$aSettings["SortDir"]." ";
// LIMIT
if ($aSettings["ArticleCount"] > 0) {
$sql .= "LIMIT 0, ".$aSettings["ArticleCount"];
}
// execute query
$db2->query($sql);
$lCount = $db2->num_rows();
if ($lStartIDArtLang > 0) {
$lCount--; // Complete list contains - not shown - start article, reduce count
}
if ($lCount > 0) {
if (!is_object($db3)) {
$db3 = new DB_Contenido;
}
if (!is_object($db4)) {
$db4 = new DB_Contenido;
}
if ($aSettings["ArticlePerPage"] > 0) {
$lStartCount = $_REQUEST["nextstep"];
$lEndCount = $_REQUEST["nextstep"] + $aSettings["ArticlePerPage"];
if ($lEndCount > $lCount) {
$lEndCount = $lCount;
}
} else {
$lStartCount = 0;
$lEndCount = $lCount;
}
$lRow = 0;
$i = 0;
while ($db2->next_record()) {
if ( $aSettings["ShowStart"] == "enabled" ||
($aSettings["ShowStart"] != "enabled" && $db2->f("idartlang") != $lStartIDArtLang)) {
if ($lRow >= $lStartCount && $lRow < $lEndCount) {
$aData[$i] = array();
$aData[$i]["Link"] = $sess->url("front_content.php?idcat=".$db2->f("idcat")."&idart=".$db2->f("id"));;
$aData[$i]["LastModified"] = $db2->f("lastmodified");
$sTmpValue = urldecode($db2->f('headline'));
if ($aSettings["HeadlineLength"] > 0 && strlen($sTmpValue) > $aSettings["HeadlineLength"]) {
# Cutting text but preserving words and entities
$sTmpValue = htmlentities(capiStrTrimAfterWord($sTmpValue, $aSettings["HeadlineLength"])."...");
}
$aData[$i]["Headline"] = $sTmpValue;
if ($aSettings["Elements"] > 0) {
for ($k = 0; $k < $aSettings["Elements"]; $k++) {
$aData[$i]["i".$k] = array();
$aData[$i]["i".$k]["Value"] = "";
$aData[$i]["i".$k]["ServerPath"] = "";
$aData[$i]["i".$k]["WebPath"] = "";
$aData[$i]["i".$k]["Width"] = 0;
$aData[$i]["i".$k]["Height"] = 0;
}
$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 = '".$db2->f("idcatart")."' AND (";
$sql_items = "";
for ($k = 0; $k < $aSettings["Elements"]; $k++) {
if ($aSettings["k".$k]["Identifier"] != "") {
if ($sql_items != "") {
$sql_items .= " OR (".$aSettings["k".$k]["Identifier"].")";
} else {
$sql_items = "(".$aSettings["k".$k]["Identifier"].")";
}
}
}
$sql .= $sql_items.")";
if ($bDebug) {
echo "<pre>".$sql."</pre>", chr(10);
}
// execute query
$db3->query($sql);
while ($db3->next_record()) {
$sTypeIdentifier = "tblData.idtype = '".$db3->f('idtype')."' AND tblData.typeid = '".$db3->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
for ($k = 0; $k < $aSettings["Elements"]; $k++) {
if ($sTypeIdentifier == $aSettings["k".$k]["Identifier"]) {
switch (TRUE) {
case ($aSettings["k".$k]["ElementType"] == "Image" || $aSettings["k".$k]["ElementType"] == "ExtractedImage"):
$sql = "";
if ($aSettings["k".$k]["ElementType"] == "Image") {
$sql = "SELECT dirname, filename FROM ".$cfg["tab"]["upl"]." ";
$sql .= "WHERE idupl = '".$db3->f('value')."'";
} else {
$sTmpValue = urldecode($db3->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);
#Don't know what is happening here, exactly...
# $img_split = preg_split("/\./", $img_name);
# $img_type = $img_split[count($img_split) - 1];
# $img_split2 = preg_split("/_/", $img_split[0]);
$name = strtolower($img_name);
#Don't know what is happening here, exactly...
#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 LOWER(filename) = '$name'";
// $sql .= "WHERE filename REGEXP '$name'"; // Old: for 'banner.jpg' 'merlin_banner.jpg' is also returned
}
}
if ($bDebug) {
echo "<pre>".$sql."</pre>";
}
// 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'))));
if ($aSettings["k".$k]["ElementWidth"] > 0 && strlen($sTmpValue) > $aSettings["k".$k]["ElementWidth"]) {
//$sTmpValue = htmlentities(substr($sTmpValue, 0, $aSettings["k".$k]["ElementWidth"])."...");
# Cutting text but preserving words and entities
$sTmpValue = htmlentities(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
#
# Per article additional element:
# $aValue["i".$i]["Value"]: Text (only for text elements, otherwise "")
# $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
$topbox_w = '515';
$editmode = false;
if($contenido&&($view=="edit")){
$editmode = true;
}
echo '<div style="background: blue; width:559px;" align="center">'; // mainwarp(Umklammerung) hier wird der content space (breite und alignment) gesetzt
echo '<div style="clear: both; width:'.($topbox_w).'px;">'; // wrap1(umklammerung) der headline 'BRANDS'
echo '<div style="float:left; width:4px; height:22px; background:url(upload/layout/prod_descr_box_L.jpg)"></div>';
echo '<div style="float:left; width:'.($topbox_w-8).'px; color: #FFFFFF; font-weight: bold; background: #a29988; text-align:left; padding: 3px 0 3px 0px;"> Brands</div>';
echo '<div style="float:left; width:4px; height:22px; background:url(upload/layout/prod_descr_box_R.jpg)"></div>';
echo '</div>'; //eof wrap1
echo '<div style="clear: both; width:'.($topbox_w - 42).'px; padding: 10px 20px 10px 20px; border:1px solid #a29988; text-align:left; background:yellow;">'; // wrap2(umklammerung) des oberen contents,
echo '<div style="font-weight: bold; font-size: 1.2em; padding: 0 0 5px 0; color:#003c78;">';
if (!editmode) {
echo strip_tags("CMS_HTMLHEAD[1]");
} else {
echo "CMS_HTMLHEAD[1]";
}
echo '</div>';
echo '<div style="color: #666;">'."CMS_HTML[1]".'</div>';
echo '</div>'; // eof wrap2
echo '<div style="width:'.($topbox_w -1).'px; border-left:1px solid #a29988; height:30px; background:red; padding: 0 0 0 0px;">';// wrap3(umklammerung) die nicht funktioniert, hier sollte die höhe duch den inhalt der folgenden foreach anweisung abhängen, wird aber nur angezeit weil ich die 30px height fest drin habe
foreach ($aData as $aValue) {
echo '<div style="float:left; width:140px; height:130px; border-right:1px solid green; border-bottom:1px solid #a29988; padding: 5px;">';// wrap4(umklammerung) die wiederum greift, wird benötigt um die ausgabe erst nach jedem 3. artikel umzubrechen und damit 3 spalten zu erzeugen
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);
}
echo ' <div id="headline">'.$aValue["Headline"].'</div>', chr(10);
break;
default: // Everything else is treated as "Text"
echo ' <div id="text">'.$aValue["i".$i]["Value"].'</div>', chr(10);
}
}
echo '</div>', chr(10); // eof wrap4
}
}
echo '</div>'; // eof wrap3
echo '</div>'; //eof mainwrap
}