Mensch sorry, irgendwie habe ich keine Benachrichtigung zu neuen Beiträgen erhalten, erst eine PM hat mich gerade darauf aufmerksam gemacht, daß es Antworten auf meine frage gab! Habe das ganze momentan sehr unelegant mit händisch gesetzten Artikellinks gelöst und wäre für eine Lösung schon noch dankbar. Hier also der Quelltext:
Code: Alles auswählen
/***********************************************
* CONTENIDO MODUL - INPUT
*
* Modulname : i-fekt.de*list v1.2
* Author : Daniel Smolcic
* Copyright : i-fekt
* Website : http://www.i-fekt.de/
* Created : 15.02.2006
* Modified : 16.02.2006
************************************************/
$selected = "CMS_VALUE[0]";
echo "<table cellspacing=\"0\" cellpadding=\"10\" border=\"0\">";
echo "<tr valign=\"top\">
<td>".mi18n("Choose category:")."</td>
<td><select name=\"CMS_VAR[0]\">";
if( $selected!="0" && $selected!="" ) {
echo "<option value=\"0\">— ".mi18n("none")." —</option>";
} else {
echo "<option selected=\"selected\" value=\"0\">— ".mi18n("none")." —</option>";
}
$sql = "SELECT
a.idcat,
a.level,
c.name
FROM
{$cfg['tab']['cat_tree']} AS a,
{$cfg['tab']['cat']} AS b,
{$cfg['tab']['cat_lang']} AS c
WHERE
a.idcat = b.idcat
AND b.idcat = c.idcat
AND c.idlang = $lang
AND b.idclient = $client
AND c.visible = 1
ORDER BY
a.idtree";
$db->query($sql);
while( $db->next_record() ) {
$spaces = "";
$levels = $db->f("level");
for( $i = 0; $i < $levels; $i++ ) {
$spaces = $spaces . "––";
}
$spaces .= "> ";
if( $selected == $db->f("idcat") ) {
echo "<option selected=\"selected\" value=\"". $db->f("idcat") ."\">". $spaces . $db->f("name") ."</option>";
} else {
echo "<option value=\"". $db->f("idcat") ."\">". $spaces . $db->f("name") ."</option>";
}
}
echo "</select>
</td>
</tr>";
echo "<tr>
<td>".mi18n("Number of articles per page:")."</td>
<td><input type=\"text\" name=\"CMS_VAR[1]\" value=\"CMS_VALUE[1]\" size=\"3\"/></td>
</tr>";
echo "<tr>
<td>".mi18n("Show startarticle:")."</td>";
$startartikel_ausgaben = "CMS_VALUE[2]";
if( $startartikel_ausgaben != "" ) {
echo "<td><input type=\"checkbox\" name=\"CMS_VAR[2]\" value=\"true\" size=\"3\" checked=\"checked\"/></td>";
} else {
echo "<td><input type=\"checkbox\" name=\"CMS_VAR[2]\" value=\"true\" size=\"3\"/></td>";
}
echo " </td>
</tr>";
echo "<tr>
<td>".mi18n("Showed indications from subheadline:")."</td>
<td><input type=\"text\" name=\"CMS_VAR[3]\" value=\"CMS_VALUE[3]\" size=\"5\"/></td>
</tr>";
echo "<tr>
<td>".mi18n("Text for previous-link:")."</td>
<td><input type=\"text\" name=\"CMS_VAR[4]\" value=\"CMS_VALUE[4]\" size=\"15\"/></td>
</tr>";
echo "<tr>
<td>".mi18n("Text for next-link:")."</td>
<td><input type=\"text\" name=\"CMS_VAR[5]\" value=\"CMS_VALUE[5]\" size=\"15\"/></td>
</tr>";
echo "<tr>
<td>".mi18n("Show articles up to:")."</td>
<td><select name=\"CMS_VAR[6]\">";
$ebene = "CMS_VALUE[6]";
for( $i=0; $i>-2; $i-- ) {
if( $i == $ebene ) {
echo "<option value=\"$i\" selected=\"selected\">".mi18n("Level")." $i</option>";
} else {
echo"<option value=\"$i\">".mi18n("Level")." $i</option>";
}
}
echo " </td>
</tr>";
echo "<tr>
<td>".mi18n("Show image:")."</td>";
$bildAusgaben = "CMS_VALUE[7]";
if( $bildAusgaben != "" ) {
echo "<td><input type=\"checkbox\" name=\"CMS_VAR[7]\" value=\"true\" size=\"3\" checked=\"checked\"/></td>";
} else {
echo "<td><input type=\"checkbox\" name=\"CMS_VAR[7]\" value=\"true\" size=\"3\"/></td>";
}
echo " </td>
</tr>";
echo "<tr>
<td>".mi18n("Image width (max.):")."</td>
<td><input type=\"text\" name=\"CMS_VAR[8]\" value=\"CMS_VALUE[8]\" size=\"3\"/></td>
</tr>";
echo "<tr>
<td>".mi18n("Image height (max.):")."</td>
<td><input type=\"text\" name=\"CMS_VAR[9]\" value=\"CMS_VALUE[9]\" size=\"3\"/></td>
</tr>";
echo "</table>";
Code: Alles auswählen
<?php
/***********************************************
* CONTENIDO MODUL - OUTPUT
*
* Modulname : i-fekt.de*list v1.2
* Author : Daniel Smolcic
* Copyright : i-fekt
* Website : http://www.i-fekt.de/
* Created : 15.02.2006
* Modified : 16.02.2006
************************************************/
# Benutzte Mandanteneinstellungen:
# Typ: artikelliste
# Name: idcat_artikelliste
# Wert: ID der auszulesenden Kategorie
# Include
cInclude('classes', 'contenido/class.client.php');
# Wenn kein Baum ausgewählt wurde, Mandanteneinstellungen benutzen
$kategorie = "CMS_VALUE[0]";
if( $kategorie == "" || $kategorie == 0 ) {
$cApiClient = new cApiClient($client);
$kategorie = $cApiClient->getProperty('artikelliste','idcat_artikelliste');
}
$angezeigteAnzahl = "CMS_VALUE[1]";
if( $angezeigteAnzahl == "" ) { $angezeigteAnzahl = 10; }
$startartikel = "CMS_VALUE[2]";
if( $startartikel == "" ) { $startartikel = false; }
$subHeadline = "CMS_VALUE[3]";
if( $subHeadline == "" ) $subHeadline = 200;
$prevText = "CMS_VALUE[4]";
if( !$prevText ) { $prevText = "zurück"; }
$nextText = "CMS_VALUE[5]";
if( !$nextText ) { $nextText = "vor"; }
$imgAusgaben = "CMS_VALUE[7]";
if( $imgAusgaben == "" ) { $imgAusgaben = false; }
$imgWidth = "CMS_VALUE[8]";
if( !$imgWidth ) { $imgWidth = "0"; }
$imgHeight = "CMS_VALUE[9]";
if( !$imgHeight ) { $imgHeight = "0"; }
$ebene = "CMS_VALUE[6]";
$limit = (isset($_GET['skip']) && $_GET['skip'] > 0)?($_GET['skip']):(0);
$db = new DB_Contenido;
$db2 = new DB_Contenido;
# Startartikel mit ausgeben oder nicht
if ($startartikel) {
$mitStartartikel = "";
} else {
$mitStartartikel = "AND c.startidartlang != b.idartlang";
}
# Liest die Artikel aus der Datenbank
switch ($ebene) {
case -1:
$sql_1 = "SELECT
count(*) AS anzahl
FROM
{$cfg['tab']['cat_art']} as a
LEFT JOIN
{$cfg['tab']['art_lang']} as b ON a.idart = b.idart
LEFT JOIN
{$cfg['tab']['cat_lang']} as c ON a.idcat = c.idcat
LEFT JOIN
{$cfg['tab']['cat']} as d ON a.idcat = d.idcat
WHERE
(
(
a.idcat = $kategorie
)
OR
(
d.parentid = $kategorie
)
)
AND b.idlang = $lang
AND b.online = 1
$mitStartartikel
";
$sql_2 = "SELECT
b.idart,
b.created,
b.lastmodified,
b.online,
b.idartlang,
d.idcat,
d.parentid
FROM
{$cfg['tab']['cat_art']} as a
LEFT JOIN
{$cfg['tab']['art_lang']} as b ON a.idart = b.idart
LEFT JOIN
{$cfg['tab']['cat_lang']} as c ON a.idcat = c.idcat
LEFT JOIN
{$cfg['tab']['cat']} as d ON a.idcat = d.idcat
WHERE
(
(
a.idcat = $kategorie
)
OR
(
d.parentid = $kategorie
)
)
AND b.idlang = $lang
AND b.online = 1
$mitStartartikel
ORDER BY
b.created DESC
LIMIT
$limit, $angezeigteAnzahl
";
break;
case 0:
$sql_1 = "SELECT
count(*) AS anzahl
FROM
{$cfg['tab']['cat_art']} as a
LEFT JOIN
{$cfg['tab']['art_lang']} as b ON a.idart = b.idart
LEFT JOIN
{$cfg['tab']['cat_lang']} as c ON a.idcat = c.idcat
LEFT JOIN
{$cfg['tab']['cat']} as d ON a.idcat = d.idcat
WHERE
a.idcat = $kategorie
AND b.idlang = $lang
AND b.online = 1
$mitStartartikel
";
$sql_2 = "SELECT
b.idart,
b.created,
b.lastmodified,
b.online,
b.idartlang,
d.idcat,
d.parentid
FROM
{$cfg['tab']['cat_art']} as a
LEFT JOIN
{$cfg['tab']['art_lang']} as b ON a.idart = b.idart
LEFT JOIN
{$cfg['tab']['cat_lang']} as c ON a.idcat = c.idcat
LEFT JOIN
{$cfg['tab']['cat']} as d ON a.idcat = d.idcat
WHERE
a.idcat = $kategorie
AND b.idlang = $lang
AND b.online = 1
$mitStartartikel
ORDER BY
b.created DESC
LIMIT
$limit, $angezeigteAnzahl
";
break;
}
$db->query($sql_1);
$db->next_record();
$anzahlArtikel = $db->f("anzahl");
$db->query($sql_2);
echo "<div style=\"font-size: 12px; margin: 0 0 20px 0; border-bottom: 1px solid #000;\">Artikelliste:</div>\n\n";
while ($db->next_record()) {
$sql = "SELECT
a.value,
a.idtype,
a.typeid,
c.filename,
c.dirname,
c.description
FROM
{$cfg['tab']['content']} AS a
LEFT JOIN
{$cfg['tab']['type']} AS b ON a.idtype = b.idtype
LEFT JOIN
{$cfg['tab']['upl']} AS c ON a.value = c.idupl
WHERE
a.idartlang = ".$db->f("idartlang")."
AND (
a.idtype = 3
OR a.idtype = 4
)
ORDER BY
a.idtype, a.typeid ASC
";
#print "<pre>$sql</pre>";
$db2->query($sql);
$db2->next_record();
$link = $sess->url("front_content.php?client=$client&lang=$lang&idcat=".$db->f("idcat")."&idart=".$db->f("idart"));
echo "<h1 style=\"font-size: 12px;\"><a href=\"$link\" class=\"artlist_headlinelink\">".urldecode($db2->f("value"))."</a></h1>\n";
echo "<p style=\"font-size: 11px;\">".$db->f("created")."</p>\n";
$db2->next_record();
// die subheadline auf die gewünschte länge reduzieren (trennung nur
// nach bzw. vor einem ganzen wort
if (strlen($db2->f("value")) > $subHeadline) {
$newSubHeadline = '';
$worte = explode (" ",strip_tags(urldecode($db2->f("value"))));
$zuLang = false;
foreach ($worte as $wort) {
if (strlen($newSubHeadline." ".$wort) >= $subHeadline) $zuLang = true;
$newSubHeadline = (!$zuLang)?($newSubHeadline." ".$wort):($newSubHeadline);
}
$newSubHeadline .= "...";
} else {
$newSubHeadline = strip_tags(urldecode($db2->f("value")));
}
echo "<p style=\"font-size: 11px;\">$newSubHeadline</p>\n";
$bildVorhanden = false;
while( $db2->next_record() ) {
if( $db2->f("idtype") == 4 && $db2->f("typeid") == 1 && $imgAusgaben != "" ) {
$imgServerPath = $cfgClient[$client]["upl"]["path"].$db2->f('dirname').$db2->f('filename');
$bild = $cfgClient[$client]["upl"]["htmlpath"].$db2->f('dirname').$db2->f('filename');
$breite = $imgWidth;
$hoehe = $imgHeight;
if ($imgWidth > 0 && $imgHeight > 0) {
# Prüfen, ob Skalierung notwendig ist
if( $imgServerPath != "" && file_exists($imgServerPath) && ($imgWidth > 0 || $imgHeight > 0) ) {
# Bild skalieren
$bild = capiImgScale($imgServerPath, $imgWidth, $imgHeight, false, false, 10, false);
# Abmessungen von Bild ermitteln
list ($breite, $hoehe, $type, $attr) = getimagesize($bild);
}
} else {
list ($breite, $hoehe, $type, $attr) = getimagesize($bild);
}
$bildVorhanden = true;
}
}
if ($bildVorhanden) {
echo "<div><img src=\"".$bild."\" width=\"".$breite."\" height=\"".$hoehe."\" title=\"".$db2->f('description')."\"/></div>\n\n";
}
echo "<hr/>";
}
# Blätterfunktion
if( $limit > 0 || $anzahlArtikel > $limit + $angezeigteAnzahl ) {
echo "<div style=\"width: 100%;\">\n";
if( $limit > 0 ) {
$skip = ($limit - $angezeigteAnzahl >= 0)?($limit - $angezeigteAnzahl):(0);
echo "<p style=\"float: left; width: 200px;\"><a href=\"".$sess->url("front_content.php?idcat=$idcat&idart=$idart&skip=$skip")."\">".$prevText."</a></p>";
}
if( $anzahlArtikel > $limit + $angezeigteAnzahl ) {
$skip = $limit + $angezeigteAnzahl;
echo "<p style=\"float: right; width: 200px;\"><a href=\"".$sess->url("front_content.php?idcat=$idcat&idart=$idart&skip=$skip")."\">".$nextText."</a></p>";
}
echo "<br style=\"clear: both;\">\n</div>\n";
}
?>