Artikelliste 4.1 von Jan Lengowski auf 4.2 umnippeln
Verfasst: Mi 6. Nov 2002, 16:03
Jupp, eigentlich schon mein ganzes Vorhaben im Betreff zusammengefasst. Um endlich die Möglichkeit zu haben, eine Teaserliste MIT Bild verwenden zu können, bastel ich gerade o.g. Modul um. Sieht bislang auch schon alles recht gut aus - nur der Dateiname des Bildes wird offenbar noch nicht richtig aus der DB ausgelesen. Nachfolgend der von mir modifizierte Output-Teil:
Der Fehler muss wohl irgendwo hier
$img = $cfgClient[3]["htmlpath"]["img"] . $db2->f("filename");
liegen (Client[3] ist richtig...). Wer weiß Rat?
Code: Alles auswählen
// second db class instance
$db2 = new DB_Contenido;
// selected category
$selcat = "CMS_VALUE[0]";
// bildbreite
$imgwidth = "CMS_VALUE[1]";
// bildhöhe
$imgheight = "CMS_VALUE[2]";
// anzahl der zeichen h1
$mxh[0] = "CMS_VALUE[3]";
// anzahl der zeichen h2
$mxh[1] = "CMS_VALUE[4]";
// select all articles in category widthout start article
$query = "SELECT ARTLANG.idside, ARTLANG.idsidelang FROM $cfgTab_cat_side AS CATART, $cfgTab_side_lang AS ARTLANG ".
"WHERE CATART.idcat = '$selcat' AND ARTLANG.idside = CATART.idside AND ARTLANG.idlang = '$lang' AND ".
"ARTLANG.online = '1' AND CATART.is_start = '0' ORDER BY CATART.idside DESC";
// execute query
$db->query($query);
unset($articleID);
unset($linkID);
// get id's of sub articles
while ($db->next_record()) {
$articleID[] = $db->f("idsidelang");
$linkID[] = $db->f("idside");
} // end while
// loop through subarticles
foreach ($articleID as $key => $value) {
// select all CMS variables of the article
$query = "SELECT * FROM $cfgTab_content WHERE idsidelang = '$value' ORDER BY typeid";
// execute query
$db->query($query);
// link
$link = $sess->url("index.php?client=$client&lang=$lang&idcat=$selcat&idside=$linkID[$key]&m=$m&s=$s");
// loop through result and extraxt data
while ($db->next_record()) {
// data type
$type = $db->f("idtype");
if ($type == 1) { // headline
$headline[] = $db->f("value");
} elseif ($type == 2) { // text
$text = $db->f("value");
} elseif ($type == 3) { // image
$value = $db->f("value");
$query = "SELECT filename FROM $cfgTab_upl WHERE idupl = '$value'";
$db2->query($query);
$db2->next_record();
$img = $cfgClient[3]["htmlpath"]["img"] . $db2->f("filename");
} // end if
} // end while
foreach ($headline as $key => $value) {
// headline length
$len = strlen($headline[$key]);
// cut headline if too long
if ($len > $mxh[$key] && $mxh[$key] > 0) {
$headline[$key] = substr($headline[$key],0,$mxh[$key]);
$headline[$key] = $headline[$key] . " ...";
} // end if
} // end foreach
// HTML template for one element
echo "<table width=\"100%\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\">
<tr valign=\"top\">
<td style=\"padding:10px\">
<img src=\"$img\" width=\"$imgwidth\" height=\"$imgheight\">
</td>
<td width=\"100%\" style=\"padding:10px\">
<span class=\"head2\">$headline[0]</span><br>
<span class=\"text\">$headline[1]</span>
</td>
</tr>
<tr valign=\"bottom\" align=\"right\">
<td colspan=\"2\">
<table width=\"100%\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\">
<td valign=\"middle\" align=\"right\" width=\"100%\"><a href=\"$link\" style=\"font-size:11px;color:#000000\">weiter </a></td>
<td align=\"right\"><a href=\"$link\"><img src=\"images/arrow.gif\" border=\"0\"></a></td>
</table></td>
</tr>
<tr valign=\"bottom\" bgcolor=\"#ffffff\" height=\"1\">
<td><img src=\"images/spacer.gif\" width=\"1\" height=\"1\"></td>
</tr>
</table>";
unset($headline);
} // end foreach
$img = $cfgClient[3]["htmlpath"]["img"] . $db2->f("filename");
liegen (Client[3] ist richtig...). Wer weiß Rat?