Verfasst: Mi 7. Jul 2004, 15:14
daß er mir die Artikelbilder nicht in der Artikelliste anzeigt!
Das Diskussionsforum zum Open Source Content Management System
https://forum.contenido.org/
Wer lesen kann ist klar im Vorteil! Lies einfach mal den ganzen Thread genau durch, da steht alles drin was du wissen musst um die Artikelliste zum laufen zu bringen.cs hat geschrieben:daß er mir die Artikelbilder nicht in der Artikelliste anzeigt!
Code: Alles auswählen
[04-Aug-2004 15:28:13] PHP Warning: Division by zero in /pool/cust/dgfc/vhosts/www.dgfc.at/html/_cms/front_content.php(563) : eval()'d code on line 1203
[04-Aug-2004 15:28:13] Invalid SQL: SELECT ARTLANG.idart, ARTLANG.idartlang, ARTLANG.lastmodified FROM con_cat_art AS CATART, con_art_lang AS ARTLANG WHERE CATART.idcat = '35' AND ARTLANG.idart = CATART.idart AND ARTLANG.idlang = '3' AND CATART.is_start = '0' AND ARTLANG.online = '1' ORDER BY ARTLANG.lastmodified DESC LIMIT 0,<br><br>
[04-Aug-2004 15:28:13] next_record called with no query pending.
Code: Alles auswählen
SELECT ... WHERE A.idart='$value'Code: Alles auswählen
SELECT ... WHERE A.idartlang='$value'Code: Alles auswählen
//$zps = "CMS_VALUE[8]"; // Anzahl der EinträgeCode: Alles auswählen
//thumbnail breite
$thumbnail_width = "CMS_VALUE[8]";Code: Alles auswählen
http://www.dgfc.at/_cms/front_content.php&a=view&eintrag=6Code: Alles auswählen
http://www.dgfc.at/_cms/front_content.php?idcat=35&a=view&eintrag=6Code: Alles auswählen
<?
/***********************************************
* CONTENIDO MODUL - OUTPUT
*
* Erweiterte Artikel liste Version 1.1 mit Seitenzählung
*
* Liste von Artikeln mit mehreren Daten basierend
* auf 4fb referenz modul
* 1.Gibt die Subheadline eines Artikel mit aus
* 2.Anschnitte nur nach ganzen Wörtern
* 3.Thumnails werden vernünftig berechnet
* Author : Evert Smit / Dirk Uptmoor / Peter Beauvain
* Copyright : None
* Created : 13-07-03
* Modified : 16-08-02 /20-09-03 upt /31-01-04 Beau/04-04-04 Beau
************************************************/
switch ($eintrag) { // das erste mal beim aufruf ist $eintrag undefiniert
case "";
$eintrag = "0"; // deswegen wertzuweisung 0
}
//Frontendpfad ermitteln
$query = "SELECT frontendpath FROM ".$cfg["tab"]["clients"]." WHERE idclient='".$client."'";
$db->query($query);
$db->next_record();
$frontendpath = $db->f("frontendpath");
//$zps = "CMS_VALUE[8]"; // Anzahl der Einträge
$zps = "6";
$max = ($eintrag + $zps);
$meineseite=$auth->url();
//------------- erstmal zählen wieviel Artikel vorhanden sind --------------------
$startarton = "AND CATART.is_start = '0' AND";
//soll der startartikel mit ausgegeben werden?.
$print_startartikel = "CMS_VALUE[14]";
if($print_startartikel !=""){
$startarton = "AND";
}
$selcat = "CMS_VALUE[0]";
if($selcat!="0" && $selcat!=""){
// select all articles in category widthout start article
$query = "SELECT ARTLANG.idart, ARTLANG.idartlang, ARTLANG.created 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' "." $startarton " ."ARTLANG.online = '1' ORDER BY ARTLANG.created DESC ";
// execute query
$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");
$eintraege = $eintraege+1;
} // end while
}
//---------------------------------Unternavigation zusammenbauen------------------------------
$gbnav = "";
$gbnav .= "<table width=610px cellspacing=0 cellpadding=0><tr>";
if ($max >= $eintraege)
$gbnav .= "<td class=textbold><p> Artikel: ".($eintrag+1)."-".($eintraege)." von ".$eintraege."</p></td>";
else
$gbnav .= "<td class=textbold><p> Artikel: ".($eintrag+1)."-".($max)." von ".$eintraege."</p></td>";
$gbnav .= "<td class=textbold align=right><p>";
$pages = $eintraege / $zps;
if ($pages > 1) {
$gbnav .= "gehe zu Seite ";
for ($ii = 0; $ii < $pages; $ii++) {
if ($ii != ($eintrag / $zps)) {
$gbnav .= "<a href=\"$meineseite&a=view&eintrag=";
$gbnav .= ($ii * $zps);
$gbnav .= "\">[".($ii+1)."]</a> ";
}
}
}
//-------------------------------- und jetzt gehts los ----------------------------
$startarton = "AND CATART.is_start = '0' AND";
//soll der startartikel mit ausgegeben werden?.
$print_startartikel = "CMS_VALUE[14]";
if($print_startartikel !=""){
$startarton = "AND";
}
//die Überschrift wird ausgegeben wenn sie nicht leer ist.
$print_mainheadline = "CMS_VALUE[2]";
//soll headline ausgegeben werden?
$print_headline = "CMS_VALUE[4]";
//soll subheadline ausgegeben werden?
$print_subheadline = "CMS_VALUE[5]";
//soll ein thumnail ausgegeben werden?
$print_thumbnail = "CMS_VALUE[7]";
//thumbnail breite
$thumbnail_width = "CMS_VALUE[8]";
//wenn thumbnails = 0
$imagetag = "";
// second db class instance
$db2 = new DB_Contenido;
// selected category
$selcat = "CMS_VALUE[0]";
if($selcat!="0" && $selcat!=""){
// select all articles in category widthout start article
$query = "SELECT ARTLANG.idart, ARTLANG.idartlang, ARTLANG.created 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' "." $startarton " ."ARTLANG.online = '1' ORDER BY ARTLANG.created DESC LIMIT $eintrag,$zps";
// execute query
$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
$gbnav .= "</p></td>";
/****************** start table **************************/
echo '
<table border="0" valign="top" cellpadding="3" cellspacing="0" width="610px">
';
/**** Überschrift der Artikelliste wird ausgegeben, wenn nicht leer ********/
if($print_mainheadline !=""){
echo '
<tr>
<td colspan="2" class="headline"> CMS_VALUE[2] <br></td>
<td align="right"> </td>
</tr>
<tr>
<td bgcolor="#8AA3B3" class="text"> </td>
<td align="right" bgcolor="#8AA3B3"> </td>
</tr>
';
}
if($print_mainheadline ==""){
echo '
<tr>
<td colspan="2" class="headline"> <br></td>
<td align="right"> </td>
</tr>
<tr>
<td bgcolor="#8AA3B3" class="text"> </td>
<td align="right" bgcolor="#8AA3B3"> </td>
</tr>
';
}
// Loop through articles
if (is_array($articleID)) {
foreach ($articleID as $key => $value) {
// select all CMS variables of the article
if($print_headline!="0" && $print_headline!=""){
$sql = "SELECT * FROM ".$cfg["tab"]["content"]." WHERE idartlang = '$value' AND idtype = '1' AND typeid = '1'";
$db->query($sql);
$db->next_record();
$headline = urldecode($db->f("value"));
for ($j=CMS_VALUE[3]; $j < CMS_VALUE[3]+20; $j++)
{
$headline1 = substr($headline , 0, $j);
$cut = substr($headline, $j);
if ((ord ($cut) == 32)||(ord ($cut) == 44)||(ord ($cut) == 45)) {
$headline= substr($headline , 0, $j);
$headline .= ' .....';
}
}
}
$cfgTab_art_lang = $cfg['tab']['art_lang'];
$cfgTab_content = $cfg['tab']['content'];
$sql = "SELECT A.author AS author, B.created AS lastmod FROM $cfgTab_art_lang AS A, $cfgTab_content AS B WHERE A.idart='$value' AND B.idartlang=A.idartlang ORDER BY B.created DESC";
$db->query($sql);$db->next_record();
$modifydate= date("d.m.y",strtotime($db->f("lastmod")));
$modifytime= date("H:i",strtotime($db->f("lastmod")));
if($print_subheadline!="0" && $print_subheadline!=""){
$sql_subheadline = "SELECT * FROM ".$cfg["tab"]["content"]." WHERE idartlang = '$value' AND idtype = '1' AND typeid = '2'";
$db->query($sql_subheadline);
$db->next_record();
$subheadline = urldecode($db->f("value"));
for ($i=CMS_VALUE[6]; $i < CMS_VALUE[6]+20; $i++)
{
$subheadline1 = substr($subheadline , 0, $i);
$cut = substr($subheadline, $i);
if ((ord ($cut) == 32)||(ord ($cut) == 44)||(ord ($cut) == 45)) {
$subheadline= substr($subheadline , 0, $i);
$subheadline .= ' .....';
}
}
}
/******************* begin thumbnails **********************************/
if($print_thumbnail !="0" && $print_thumbnail !=""){
// select and resolve image path
$imagesql="select value from ".$cfg["tab"]["content"]." where idartlang='$value' and idtype='4' and typeid='CMS_VALUE[11]'";
$db2->query($imagesql);
$db2->next_record();
$image_id= $db2->f("value");
// get image name and path
$imagesql="select * from ".$cfg["tab"]["upl"]." where idupl='$image_id'";
$db2->query($imagesql);
$db2->next_record();
$webdir='upload/';
$thumbdir='CMS_VALUE[9]';
$filedir=$frontendpath;
$imagelocation=$filedir.$webdir.$db2->f('dirname').$db2->f('filename');
$thumblocation=$filedir.$webdir.$thumbdir.$db2->f('filename');
if (!file_exists($thumblocation)){
// create thunbnail
$fileinformation=getimagesize($imagelocation);
$imagewidth = $fileinformation[0];
$imageheight = $fileinformation[1];
$imagetype=$db2->f('filetype');
$imageattributes = $fileinformation[3];
//$newfile= $last_id."-image.".$imagetype;
$target=$thumblocation;
if ( !(copy($imagelocation,$target)))
{
echo "Could not copy file to destintaion., Command returned Error Message. Please check your log files. ".$imagelocation." ".$target;
die;
}
//create thumbnails 80xrelational height; neu $thumbnail_width x proportionale Höhe
// Determine what filetype and set pointer to source image
$original_image=ImageCreateFromJPEG($target);
if (!$original_image){
echo 'Error getting image from '.$target.'.';
}
$palette_image =$filedir.$webdir.$thumbdir.'vorlage.jpg';
$thumbsize = getImageSize($palette_image);
$maxdim = $thumbsize[0];
$draw_from = $imagelocation;
$dim = GetImageSize($draw_from);
if($dim[0]>$dim[1])
{
$to_w = $maxdim;
$to_h = round($dim[1]*($maxdim/$dim[0]));
$to_x = 0;
$to_y = round($maxdim-$to_h)/2;
}
else
{
$to_h = $maxdim;
$to_w = round($dim[0]*($maxdim/$dim[1]));
$to_y = 0;
$to_x = round($maxdim-$to_w)/2;
}
if($dim[2]==1) {$from = ImageCreateFromGIF($draw_from);}
elseif($dim[2]==2) {$from = ImageCreateFromJPEG($draw_from);}
elseif($dim[2]==3) {$from = ImageCreateFromPNG($draw_from);}
$thumb = ImageCreateFromJPEG($palette_image);
// $set_bg_colour = ImageColorAllocate($thumb,255,0,0);
// $fill_bg_colour = ImageFill($thumb,0,0,$set_bg_colour);
imagecopyresampled($thumb, $from, $to_x, $to_y, 0,
0, $to_w, $to_h, $dim[0], $dim[1]);
//echo $target;
// set image width and height of thunbnail and put pointer for filesytsem
$thumbfile= $db2->f('filename');
$target_thumb=$thumblocation;
$t_width=$thumbnail_width;
// calculating height to maintain ratio
$t_height=($thumbnail_width/$imagewidth)*$imageheight;
// remove digits to get solid number
list ($t_height,$notimportand)=explode('.',$t_height);
// create blank image
$thumb_image=imagecreatetruecolor($t_width,$t_height);
// $thumb_image=imagecreate($t_width,$t_height);
// $thumb_image=ImageCreateFromJPEG($palette_image);
// resize image based on height and width
imagecopyresampled($thumb_image,$original_image,0,0,0,0,$t_width,$t_height,$imagewidth,$imageheight);
// store image on file system
// requires different functionf for either gif or jpeg
imagejpeg($thumb,$target_thumb);
imagedestroy($thumb);
imagedestroy($original_image);
}
$image=$webdir.$thumbdir.$db2->f('filename');
//wenn Artikel kein Bild hat
if (!$db2->f('filename')){
$image=$webdir.$thumbdir.'vorlage.jpg';
}
//Ende
$imagetag="<img src=\" $image \" border=0>";
} // ende wenn keine thumbs gewünscht
/**************** Ende Thumbnails ***********************/
// link
$link = $sess->url("front_content.php?client=$client&lang=$lang&idcat=$selcat&idart=$linkID[$key]&m=$m&s=$s");
/***********************Anfang Tablezeile für Artikelliste**********************/
echo '
<tr>
<td colspan="2" class="trnews1" cellpadding="2" ><!-- <img src="upload/bilder/date.gif" border="0" align="right"> --><A HREF="'.$link.'">'.$headline.'</a></td>
<td class="trnews2"><A HREF="'.$link.'">'.$modifydate.'</a></td>
</tr>
<tr>
<td width=\"$thumbnail_width\" align="left" bgcolor="#8AA3B3"><A HREF="'.$link.'">'.$imagetag.'</a></td>
<td bgcolor="#8AA3B3" class="newstext" valign="top">'.$subheadline.'<td valign="bottom"><a href="'.$link.'"><img src="upload/news/mehr.gif" border="0" align="right"></a></td></td>
</tr>
<tr><td bgcolor="#8AA3B3"><IMG SRC="$frontendpath/cms/bilder/fueller.gif" WIDTH="1" HEIGHT="3"
BORDER="0"></td></tr>
';
} // end while
unset($headline);
unset($headline1);
unset($subheadline);
unset($subheadline1);
} // end foreach
// -------------- Ausgabe der Seiten Navigation ----------------------
echo $gbnav;
// --------------- Ende der Seiten Navigation -------------------------
} // end if (is_array)
echo '</table>';
/***********************ende Table**********************/
?>
Ich habe also ein weiteres CMS_IMG[5] erstellt doch leider nicht richtig ;( bei der Thumb anzeige in der Vorschau ist alles OK aber in der Detailansicht wird über dem Bild der gesamte Pfad dargestellt und ich komme leider alleine nicht weiterKleiner Tipp: Da ich in den Artikeln keine Bilder benutze habe ich ein CMS_IMG[5] erstellt,
dies ist im Modulquelltext auf die Größe 0x0px eingestellt. Den Modulcontainer kann man
und z.B. zwischen Headline und Subheadline im Layout für die Artikel platzieren,
nun kann der Redakteur dort das Bild auswählen, welches dann in der Artikelliste als Thumb
dargestellt wird.
Code: Alles auswählen
<?php
if ("CMS_IMG[5]" != "") {
$img = '<img src="CMS_IMG[5]" border="0">';
if ("CMS_LINK[5]" != "http://") {
$img = sprintf('<a href="%s" target="%s">%s</a>',"CMS_LINK[5]", "CMS_LINKTARGET[5]", $img);
}
echo $img;
}
echo "<br>";
echo "CMS_IMGDESCR[5]";
echo "<br>";
echo "CMS_LINKDESCR[5]";
echo "<br>";
?>Dass eine gif-Datei keine gueltige jpg-Datei ist, sollte einleuchtend sein und auch einem Laien auffallen.GoofyUlm hat geschrieben:[19-Aug-2004 23:33:00] PHP Warning: imagecreatefromjpeg(): '/srv/www/htdocs/web12/html/cmsys/weber/upload/bilder/rastawoman2_50prozent.gif' is not a valid JPEG file in /srv/www/htdocs/web12/html/cmsys/admin/includes/include.con_editcontent.php(571) : eval()'d code on line 1642