Seite 1 von 1
Bild-Link fehlt in Datenbank
Verfasst: Di 30. Okt 2007, 10:47
von ctschorsch
Hallo zusammen,
nach langer Zeit beschäftige ich mich mal wieder mit Contenido und hab auch just ein Problem

Bin mitlerweile bei Version 4.6.15, aber das nur zur Info.
Ich versuche eine Artikelliste zu Programmieren, in der auch ein Bild angezeigt werden soll. Dieses Bild ist in den Artikel der Kategorie mit CMS_IMG[1] hinterlegt. Bisher konnte ich immer die CMS Vars aus der Datenbank abfragen und über idtype und typeid kam ich an meinen Pfad
idtype=6 => CMS_IMG, typeid muss dann hier 1 sein und dann stand bisher in value immer mein pfad

aber dat bei mir komischerweise nimmer.
Wurde da was geändert ?
Gruss Georg
Verfasst: Di 30. Okt 2007, 10:48
von kummer
diese info solte sich nach meiner meinung in der con_content finden.
Verfasst: Di 30. Okt 2007, 10:53
von ctschorsch
genau, da frag ich sie auch ab
ich frag ja auch CMS_HEAD und andere teile ab, alles da. nur mein CMS_IMG taucht irgends auf, obwohl das bild im eigentlichen artikel angezeigt wird.
ich poste mal den code
Code: Alles auswählen
<?
// selected category
$selcat = "CMS_VALUE[0]";
$maxlen = "CMS_VALUE[1]";
if (strlen($maxlen)<=0) $maxlen=100;
$box1titel="CMS_VALUE[8]";
$box2titel="CMS_VALUE[9]";
// template klasse includen
cInclude("classes", "class.template.php");
// template instanz
$tpl = new Template;
$tpl2 = new Template;
$tpl->reset();
$tpl2->reset();
$tpl->set('d','HTMLHEAD1',"CMS_HTMLHEAD[1]");
$tpl->set('d','HTMLHEAD2',"CMS_HTMLHEAD[2]");
$tpl->next();
if ((strlen($box1titel)==0) && (strlen($box2titel)==0))
$tpl->generate("templates/vds-top-full.html", false, false);
else
$tpl->generate("templates/vds-top.html", false, false);
/*******************************************************/
if($selcat!="0" && $selcat!="") {
$query = "SELECT ARTLANG.idart, ARTLANG.idartlang FROM ".$cfg["tab"]["cat_art"]." AS CATART, ".
$cfg["tab"]["art_lang"]." AS ARTLANG ".
"WHERE CATART.idcat = '$selcat' AND ARTLANG.idart = CATART.idart AND ARTLANG.idlang = '$lang' AND ".
"ARTLANG.online = '1' AND CATART.is_start='0' ORDER BY ARTLANG.artsort DESC";
$db->query($query);
unset($articleID);
unset($linkID);
// get id's of sub articles
while ($db->next_record()) {
$articleID[] = $db->f("idartlang");
$linkID[] = $db->f("idart");
} // end while
}
// loop through subarticles
$tpl->reset();
if (is_array($articleID)) {
foreach ($articleID as $key => $value) {
// select all CMS variables of the article
$sql = "SELECT * FROM ".$cfg["tab"]["content"]." WHERE idartlang = '$value'";
$db->query($sql);
//get content data
while ($db->next_record()) {
$dbtext = urldecode($db->f("value"));
$type = $db->f("idtype");
$id = $db->f("typeid");
//parse content data
echo "hier: ".$type.":".$typeid.":".$dbtext."<br>";
switch($type) {
//CMS_HTMLHEAD
case 1: if ($id==1) $title=$dbtext;
if ($id==2) $subtitle=$dbtext;
break;
//CMS_HTML
case 2: if($id==1) $text=strip_tags($dbtext);
break;
//CMS_IMG
case 6: if($id==1)$img=$dbtext;
break;
//CMS_HEAD
case 9: break;
}
if ( strlen($text) > $maxlen) {
$text = substr($text, 0, $maxlen);
$text = substr($text,0,strrpos($text," "))." ...";
}
// link
$link = $sess->url("front_content.php?client=$client&lang=$lang&idcat=$selcat&idart=$linkID[$key]&m=$m&s=$s");
unset($type); unset($id); unset($dbtext);
} //end while
//check for thumbnailpath
if (strlen($img)==0) $img="images/thumbblank.jpg";
echo "IMG: ".$img."<br>";
$basepath=$cfgClient[$client]["path"]["frontend"];
$path=$basepath.substr($img,0,strrpos($img,'/')+1);
if (!file_exists($path."/thumbs")) {
if (!mkdir($path."/thumbs")) {
echo "Error on create thumbs directory<br>";
}
}
//check for thumbnail
$file=substr($img,strrpos($img,'/')+1);
$file=substr($file,0,strlen($file)-4);
$fileend=substr($img,strrpos($img,'.')+1);
$thumb=$path."thumbs/".$file."_k.".$fileend;
if(!file_exists($thumb)) {
$file=$path.$file.".".$fileend;
system("/usr/bin/convert -scale 100x100 ".$file." ".$thumb);
}
$thumb=substr($thumb,strlen($basepath));
//Ausgabe der Produkte
$tpl->set('d','IMAGE',$thumb);
$tpl->set('d','TITLE',$title);
$tpl->set('d','SUBTITLE',$subtitle);
$tpl->set('d','TEXT',$text);
$tpl->set('d','LINK',$link);
$tpl->next();
unset($text); unset($title); unset($subtitle); unset($file); unset($path);
unset($thumb);
} // end foreach
} //end if(array)
$tpl->generate('templates/vds-bildlist-item.html',false,false);
/***************************************************/
$tpl->reset();
if ((strlen($box1titel)!=0) || (strlen($box2titel)!=0)) {
if(strlen($box1titel)!=0) {
$tpl->set('d','TITEL',$box1titel);
$tpl->set('d','INHALT',"CMS_HTML[2]");
$tpl->next();
}
if(strlen($box2titel)!=0) {
$tpl->set('d','TITEL',$box2titel);
$tpl->set('d','INHALT',"CMS_HTML[3]");
$tpl->next();
}
$tpl->generate("templates/vds-bottom.html", false, false);
} else
$tpl->generate("templates/vds-bottom-full.html", false, false);
?>
Verfasst: Di 30. Okt 2007, 11:02
von kummer
und via phpMyAdmin hast du auch schon mal gesucht?
Verfasst: Di 30. Okt 2007, 11:04
von ctschorsch
ne, such gerade per mysql consolen client

Verfasst: Di 30. Okt 2007, 11:09
von ctschorsch
und es steht nix drinne, also zumindest nix mit idtype = 6
*wunder*
G
Verfasst: Di 30. Okt 2007, 11:24
von kummer
nun, die cms_img hat nach meiner einschätzung auch nicht die 6, sondern die 4 (ich habe eine 4.6.23 lokal am laufen). schau doch mal in der con_type, ob das bei dir wirklich die 6 ist.
Verfasst: Di 30. Okt 2007, 11:28
von ctschorsch
mist, da hast du wohl recht. da war wohl noch en restbestand vom CMS_LINK bei mir mit drinne. na, dann muss ich da jetzt mal einiges ändern, den pfad zu dem bild bekomm ich ja gerade nimmer so einfach
danke für den wink mit dem bauzaun
Georg
Verfasst: Mi 31. Okt 2007, 22:22
von HerrB
Ansonsten einen Blick in den Code von entsprechenden Modulen werfen (e.g. Artikelliste Advanced .. *Werbung* ...

).
Gruß
HerrB