Seite 1 von 1
					
				Newsmodule erweitern
				Verfasst: Fr 11. Jul 2003, 14:03
				von Evert
				Hallo allerseits,
ich probiere schon sein laengerem beim newsmudle das zusammenfassungs feld auszugeben. kann bir da jemand helfen, da es im jetztigen db object nicht enthalten zu sein scheint.
gruss
			 
			
					
				
				Verfasst: So 13. Jul 2003, 15:16
				von Evert
				OK habs selber gefunden, obwohl ich ehrlich zugeben muss dass ich JOINS hasse 
hier das SQL statement
Code: Alles auswählen
          $sql = "SELECT ".$cfg["tab"]["content"].".*,".$cfg["tab"]["art_lang"].".summary  
                  FROM ".$cfg["tab"]["content"]." 
                  left join ".$cfg["tab"]["art_lang"]." 
                  on ".$cfg["tab"]["content"].".idartlang=".$cfg["tab"]["art_lang"].".idartlang   
                  WHERE ".$cfg["tab"]["content"].".idartlang = '$value' 
                  AND ".$cfg["tab"]["content"].".idtype = '1' 
                  AND ".$cfg["tab"]["content"].".typeid = '1'";
 
			 
			
					
				Nochmals erweitert
				Verfasst: Mi 16. Jul 2003, 13:35
				von Evert
				Code: Alles auswählen
<?
/***********************************************
* CONTENIDO MODUL - OUTPUT
*
* Erweiterte Artikel liste
*
* Liste von Artikeln mit mehreren Daten basierend 
* auf 4fb referenz modul
*
* Author      :     Evert Smit
* Copyright   :     4fB
* Created     :     13-07-2003
* Modified    :     16-08-2002
************************************************/
// 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 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' ORDER BY CATART.idart 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");
} // end while
// loop through subarticles
echo '
<table width="70%" border="0" cellspacing="0" cellpadding="0">
<tr><td class=titel>CMS_VALUE[2]</td></tr><TR><TD><UL>
';
if (is_array($articleID)) {
    foreach ($articleID as $key => $value) {
          // select all CMS variables of the article
          $sql = "SELECT ".$cfg["tab"]["content"].".*,".$cfg["tab"]["art_lang"].".summary  
                  FROM ".$cfg["tab"]["content"]." 
                  left join ".$cfg["tab"]["art_lang"]." 
                  on ".$cfg["tab"]["content"].".idartlang=".$cfg["tab"]["art_lang"].".idartlang   
                  WHERE ".$cfg["tab"]["content"].".idartlang = '$value' 
                  AND ".$cfg["tab"]["content"].".idtype = '1' 
                  AND ".$cfg["tab"]["content"].".typeid = '1'";
          $db->query($sql);
          $db->next_record();
          // select and resolve image path
          $imagesql="select value from ".$cfg["tab"]["content"]." where idartlang='$value' and idtype='4' and typeid='1'";
          $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='thumbnails/';
          $filedir='/home/www/contenido/motosommer/';
          $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
				// Determine what filetype and set pointer to source image
				switch ($imagetype)
				{
					case "gif":
						$original_image=imagecreatefromgif($target);
						break;
					case "png":
						$original_image=imagecreatefrompng($target);
						break;
					case "jpg":
						$original_image=imagecreatefromjpeg($target);
						break;
				}
				
				if (!$original_image){
					echo 'Error getting image from '.$target.'.';
				}	
				//echo $target;
				// set image width and height of thunbnail and put pointer for filesytsem
				$thumbfile= $db2->f('filename');
				$target_thumb=$thumblocation;
				$t_width=80;
				// calculating height to maintain ratio
				$t_height=(80/$imagewidth)*$imageheight;
				// remove digits to get solid number
				list ($t_height,$notimportand)=explode('.',$t_height);
				// create blank image
				$thumb_image=imagecreate($t_width,$t_height);
				
				// resize image based on height and width
				imagecopyresized($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
				switch ($imagetype)
				{
					case "gif":
						imagegif($thumb_image,$target_thumb);
						break;
					case "png":
						imagepng($thumb_image,$target_thumb);
						break;
					default:
						imagejpeg($thumb_image,$target_thumb,75);
						break;
				}
				imagedestroy($thumb_image);
				imagedestroy($original_image);
          }
          $image=$webdir.$thumbdir.$db2->f('filename');
			
          $head = $db->f("value");
          $summary= $db->f("summary");
          if ( strlen($head) > CMS_VALUE[3]) {
            $head = substr($head, 0, CMS_VALUE[3]);
            $head .= '..';
          }
          // link
          $link = $sess->url("front_content.php?client=$client&lang=$lang&idcat=$selcat&idart=$linkID[$key]&m=$m&s=$s");
          //echo '<tr><td><A HREF="'.$link.'">'.$db->f("value").'</a></td></tr>';
          echo '<LI><A HREF="'.$link.'">'.$head.'</a><BR>'.$summary.'<img src="'.$image.'">';
    } // end while
echo '</TD></TR>';
          unset($head);
        unset($summary);
        
    } // end foreach
    
} // end if (is_array)
echo '</table><br>';
?>
das hier ist der output code der modifizierten artikel liste. das teil unterhaelt automatishc ein thumbnail directory (hardcodiert) und zeigt eine artikel liste mit einem bild an welches mittels bild modul (1) auf dem artikel vorhanden ist.
Verbesserungsvorschlaege willkommen 

 Verbesserter Code ist noch mehr willkommen 

 
			 
			
					
				
				Verfasst: Mi 3. Sep 2003, 14:43
				von Marten
				Hi Evert, 
ich habe mich gerademal an Dein Script gewagt. 
Leider erhalte ich nur folgende Fehlermeldung:
"Could not copy file to destintaion., Command returned Error Message. Please check your log files. /home/www/cms/upload/Vermittlungs-Bilder/susi.jpg /home/www/cms/upload/thumbnails/susi.jpg"
Wie Du siehst, habe ich den Pfad zum "$filedir" schon angepaßt, was mir 
nicht wirklich weiterhalf ...  
 
Hast du irgend eine Idee?
Marten
 
			 
			
					
				
				Verfasst: Mi 3. Sep 2003, 16:07
				von Evert
				gibts das ziel verzeichniss /home/www/cms/upload/thumbnails/ bei deinem rechner?
gruss
			 
			
					
				
				Verfasst: Mi 3. Sep 2003, 16:32
				von Marten
				DAS genau der Fehler, den ich gemaxcht habe ... 
 
PHPINFO hat mir aber gerade verraten, daß 
"DOCUMENT_ROOT  /home/domains/de/tierschutzverein-neuss/www" ist. 
Habe ich dann entsprechend eingetragen. Und es läuft!!!  
 
Allerdings habe ich mal wieder - komischerweise nur bei wenigen - das Problem, das auch andere Artikellisten-Module  der 4.3er hattenhatten:
HTML-Code wird umgesetzt und so angezeigt
(ich weiß es leider nicht besser zu umschreiben ...):
Z.B. "%3CP%3EJette%3C%2FP%3E", wi eigentlich nur "Jette" stehen sollte
oder "Dalida+-+%3CFONT+color%3D%23ff0000%3EVermittelt%3C..", Wo nur "Dalida" strehen sollte.
Wen Du Lust und Zeit hast, kannst Du's Dir ja mal anschauen:
http://www.tsv-neuss.de/cms/front_content.php?idcat=4 
Schöne Grüße 
Marten
 
			 
			
					
				
				Verfasst: Do 4. Sep 2003, 19:39
				von Marten
				Schonwieder ich ...  
 
Jetzt habe ich das alles ganz gut zum Laufen gebracht. 
Leider tauchte soeben ein neues Problem auf:
In EINER Kategorie läuft das Modul tadellos!
(
http://www.tsv-neuss.de/cms/front_content.php?idcat=4)
Als ich aber gerade eine zweite Kategorie damit 
"versorgen" wollte, lief die überhaupt nicht:
Ich kann zwar im Bereich "Artikel" noch die Eigenschaften
konfigurieren. Aber in der Übersicht, dem Editor und der 
Vorschau bekomme ich nur noch eine weiße Seiten!  
 
HIIIEELFEEE!!!
Ich weiß leider nicht genau, welche weiteren Infos noch wichtig wären ...
Marten
 
			 
			
					
				
				Verfasst: Fr 5. Sep 2003, 16:39
				von Marten
				Prima hier:
Hat sich durch den Artikel 
http://contenido.de/forum/viewtopic.php?t=1788 geklärt. 
DANKEEEE!!!  
 
Marten