Verfasst: Do 21. Sep 2006, 10:19
Danke für die schnelle Antwort Dodger77! Leider führt das nur dazu, dass alle Listeneinträge im Zustand 'Headline' angeziegt werden.Probier doch mal statt dessen:
Code:
if ($idart == $aData["idart"]) {
Das Diskussionsforum zum Open Source Content Management System
https://forum.contenido.org/
Danke für die schnelle Antwort Dodger77! Leider führt das nur dazu, dass alle Listeneinträge im Zustand 'Headline' angeziegt werden.Probier doch mal statt dessen:
Code:
if ($idart == $aData["idart"]) {
Code: Alles auswählen
$aData[$i]["Published"] = $db2->f("published");
Code: Alles auswählen
$aData[$i]["idart"] = $db2->f("id");
Code: Alles auswählen
if ($idart == $aValue["idart"]) {
Code: Alles auswählen
$iPages = intval($lCount / $aSettings["ArticlePerPage"]);
Code: Alles auswählen
if (($lCount % $aSettings["ArticlePerPage"])>0) $iPages++;
Code: Alles auswählen
# 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="blaettern">', chr(10);
# Example: |< 1 ... 3 4 5 ... 8 >|
$iPages = intval($lCount / $aSettings["ArticlePerPage"]);
if (($lCount % $aSettings["ArticlePerPage"])>0) $iPages++;
$sPageLinks = '';
echo ' <div id="Pages">'."\n";
if ($_REQUEST["nextstep"] > 0) {
echo ' <a href="front_content.php?idcat='.$idcat.'&idart='.$idart.'&nextstep='.($_REQUEST["nextstep"]-$aSettings["ArticlePerPage"]).'"><img src="../cms/images/zureuck2.gif" alt="" height="4" width="14" border="0" align="bottom"/> </a>', chr(10);
}
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";
if (($_REQUEST["nextstep"] + $aSettings["ArticlePerPage"]) < $lCount) {
echo ' <a href="front_content.php?idcat='.$idcat.'&idart='.$idart.'&nextstep='.($_REQUEST["nextstep"]+$aSettings["ArticlePerPage"]).'"> <img src="../cms/images/vor.gif" alt="" height="4" width="14" border="0" align="bottom"/></a>', chr(10);
}
echo ' </div>'."\n";
echo '</div>'."\n"; # Closing Browsing div
}
}
Ja, kann man. Dafür haben wir hier im Forum eine Suche. Und in dem Thread, den du dann findest, gibt es auch Informationen zu der Funktionsweise.hassarabarber hat geschrieben:und kann man es hier finden ?
Code: Alles auswählen
# 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]["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
# 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 class="alarmore">', chr(10);
# if ($_REQUEST["nextstep"] > 0) {
# echo ' <div class="alarmore">', 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"]);
if (($lCount % $aSettings["ArticlePerPage"])>0) $iPages++;
$sPageLinks = '';
echo ' <div id="Pages">'."\n";
echo 'Seite';
if ($_REQUEST["nextstep"] > 0) {
echo ' <a href="front_content.php?idcat='.$idcat.'&idart='.$idart.'&nextstep='.($_REQUEST["nextstep"]-$aSettings["ArticlePerPage"]).'">|<</a> ', chr(10);
}
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";
if (($_REQUEST["nextstep"] + $aSettings["ArticlePerPage"]) < $lCount) {
echo ' <a href="front_content.php?idcat='.$idcat.'&idart='.$idart.'&nextstep='.($_REQUEST["nextstep"]+$aSettings["ArticlePerPage"]).'">>|</a>', chr(10);
}
echo ' </div>'."\n";
echo '</div>'."\n"; # Closing Browsing div
}
foreach ($aData as $aValue) {
$datum = strtotime($aValue["Created"]);
$tag = date("j",$datum);
$monat = date("m",$datum);
$jahr = date("Y",$datum);
$monat = str_replace(
array('01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12'),
array('. Januar ', '. Februar ', '. März ', '. April ', '. Mai ', '. Juni ', '. Juli ', '. August ', '. September ', '. Oktober ', '. November ', '. Dezember '),
$monat
);
echo '<div class="articlelist">', chr(10);
echo '<div class="alistheader">', chr(10);
echo '<div class="alisttitle">'.$aValue["Category"].'<a href="'.$aValue["Link"].'"><img valign="top" alt="Artikel lesen" align="right" src="../contenido/images/mandants/go.gif" border="0" /></a>';
echo '</div>', chr(10);
echo '</div>', chr(10);
echo '<div class="alistbody">', chr(10);
echo '<div class="alarttitle">'.$aValue["Headline"].'</div>', chr(10);
echo '<div class="alartdate">'.$tag.$monat.$jahr.'</div>';
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(str_replace($cfgClient[$client]["path"]["htmlpath"], $cfgClient[$client]["path"]["frontend"], $image));
} else {
$image = $aValue["i".$i]["WebPath"];
$width = $aValue["i".$i]["Width"];
$height = $aValue["i".$i]["Height"];
}
}
if ($image != "") {
echo '<span class="alartthumb"><a href="'.$aValue["Link"].'"><img src="'.$image.'" border="0" alt="'.$aValue["Headline"].' - Artikel lesen" width="'.$width.'" height="'.$height.'" /></a></span>', chr(10);
}
break;
default: // Everything else is treated as "Text"
echo '<div>', chr(10);
echo '<span class="alarttext">'.$aValue["i".$i]["Value"].'</span>', chr(10);
echo '</div>', chr(10);
echo '<div class="textende"> </div>', chr(10);
}
}
}
echo '</div>', chr(10);
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 class="alarmore">', chr(10);
# if ($_REQUEST["nextstep"] > 0) {
# echo ' <div class="alarmore">', 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"]);
if (($lCount % $aSettings["ArticlePerPage"])>0) $iPages++;
$sPageLinks = '';
echo ' <div id="Pages">'."\n";
echo 'Seite';
if ($_REQUEST["nextstep"] > 0) {
echo ' <a href="front_content.php?idcat='.$idcat.'&idart='.$idart.'&nextstep='.($_REQUEST["nextstep"]-$aSettings["ArticlePerPage"]).'">|<</a> ', chr(10);
}
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";
if (($_REQUEST["nextstep"] + $aSettings["ArticlePerPage"]) < $lCount) {
echo ' <a href="front_content.php?idcat='.$idcat.'&idart='.$idart.'&nextstep='.($_REQUEST["nextstep"]+$aSettings["ArticlePerPage"]).'">>|</a>', chr(10);
}
echo ' </div>'."\n";
echo '</div>'."\n"; # Closing Browsing div
}
}
# Clearing memory
unset ($aData);
unset ($aSettings);
unset ($i);
unset ($lCount);
unset ($bDebug);
?>
Code: Alles auswählen
/*ARTICLELIST*/
.articlelist {height: 100%; margin: 10px 0px 0px 0px; background-color: #E6FFFA; border: 1px solid #000000;}
.alistheader {padding: 1px 10px 1px 10px; background-color: #009275;}
.alistheaderende {clear: both;}
.alistbody {padding: 10px 10px 10px 10px;}
.alisttitle {margin: 10px 0px 0px 0px; font-family: Arial,Helvetica; font-size: 12px; color:#FFFFFF; font-weight: bold;}
.alartmore {float: right;}
.alistscrollbar {}
.alslabel {margin: 0px 0px 0px 3px; font-weight: bold;}
.alslink {margin: 0px 0px 0px 3px;}
.alistletter {clear: left; font-size: 12px; font-weight: bold; margin: 6px 0px;}
.alistentry {clear: left; margin: 3px 0px;}
.alarthead {font-size: 10px;}
.alarttitle {clear: right; margin: 5px 0px 0px 0px; font-family: Arial,Helvetica; font-weight: bold; font-size: 11px;}
.alarttitle a {color:#009275;}
.alartdate {margin: 0px 0px 0px 0px; font-family: Arial,Helvetica; font-size: 11px; float: right;}
.alartdate a {color:#009275;}
.alseparator {clear: left; margin: 0px 3px; border-top: #000000 1px dotted;}
.alartbody {margin: 20px 0px 0px;}
.alartthumb {clear: right; float: left; padding-bottom: 15px; padding-top: 0px; padding-right: 15px;}
.alarttext {font-family: Arial,Helvetica; font-size: 11px; margin: 3px 0px 0px; text-align: block;}
.alarmore {margin-top: 10px; font-family: Arial,Helvetica; font-size: 12px; font-weight: bold; text-align: right;}
.alarmore a {color:#009275;}
.textende {clear: both;}
Dies betrifft wohl den Eintrag von benja. Aber auch mit dem Post auf den hier verwiesen wird, ist mir das leider nicht verständlich. Es wäre nett, wenn mir jemand eine genauere Erläuterung geben könnte, da der Code von benja so nicht funktioniert.HerrB hat geschrieben:Wie irgendwann mal erwähnt, muss ceil statt intval verwendet werden, known bug...
Gruß
HerrB