Artilliste

kuchi
Beiträge: 222
Registriert: So 29. Jun 2003, 18:02
Wohnort: Neubrandenburg
Kontaktdaten:

Artiliste

Beitrag von kuchi » Mi 24. Mär 2004, 18:49

Hi,

schau mal unter www.lidahilfe.de / Aktuell und gehe mal auf irgendeinen Artikel -> zur Demonstration; wenn noch Fragen, dann schick ich Dir noch ein paar Info's...

Gruß kuchi

m20
Beiträge: 44
Registriert: Di 16. Mär 2004, 15:02
Kontaktdaten:

Beitrag von m20 » Mi 24. Mär 2004, 20:12

Hi Kuchi!

Wie hast du es geschafft, für jeden Artikel ein eigenes Bild zu verwenden?
MfG
M20

ihp media - Agentur für Mediengestaltung
- Webseiten
- Online Shops
- Hosting (auf unseren dedizierten Servern)

http://www.ihp-media.de
http://www.dusyma.de
http://www.myjobs24.de - Job-Auktionen für Alle!
http://www.flirt-affairs.de
http://www.fc-normannia.de
http://www.convertit.de

Dennis
Beiträge: 53
Registriert: Di 16. Dez 2003, 09:47
Kontaktdaten:

Beitrag von Dennis » Do 25. Mär 2004, 09:33

indem du in jedem artikel ein anderes bild nimmst?
Bild

kuchi
Beiträge: 222
Registriert: So 29. Jun 2003, 18:02
Wohnort: Neubrandenburg
Kontaktdaten:

Artiliste

Beitrag von kuchi » Do 25. Mär 2004, 12:02

Hi,

So ist es. Du legst ja für jede Meldung einen Artikel an und hast somit die Möglichkeit immer das gewünschte Bild ins Bild (X)- Modul einzufügen...


Gruß kuchi

pansen
Beiträge: 26
Registriert: Do 26. Feb 2004, 11:57
Kontaktdaten:

Beitrag von pansen » Do 25. Mär 2004, 18:40

heyho,

bin auch ganz begeistert von diesem exemplar hier, jedoch habe auch ich ein problem damit:
wenn ich eine kategorie wähle, dann werden die artikel darin nicht angezeigt, wähle ich einen artikel dirket und sage 'mit startartikel', dann wird zumindest der artikel ansich korrekt dargestellt (logisch, dass dann nichts mehr dazu kommt).
wenn ich nun folgende abfragen aus dem sql-query rausnehme:

ARTLANG.idart = CATART.idart
ARTLANG.idlang = '$lang' "." $startarton " ."ARTLANG.online = '1'

dann werden wenigstens alle (und noch artikel, die gar keine sind) angezeigt. das problem ist jetzt, dass meine artikel alle online sind, trotzdem nicht in der vorschau gezeigt werden.

hat jemand einen heissen tip?

danke euch,

andi

Robatzen
Beiträge: 84
Registriert: Di 27. Jan 2004, 17:03
Kontaktdaten:

Beitrag von Robatzen » Fr 26. Mär 2004, 10:31

So, da ich das Modul wirklich genial finde und ebenfalls die Notwendigkeit bestand es mehrmals in einem Template einzusetzen, habe ich mal versucht die Variablen so anzupassen, das man es doppelt einsetzen kann.

Allerdings bin ich auf ein Problem gestossen, der Text und die Überschriften werden so weit richtig angezeigt, nur bei den Bildern muss ich irgendeinen Fehler gemacht haben. Wäre nett wenn da vielleicht nochmal jemand drüberfliegt und mir kurz sagt was ich falsch gemacht habe.

Hier der Code für eine zweite Artikelliste im selben Template, allerdings noch ohne Bilder.

Gruß, Rob

Code: Alles auswählen


INPUT

/**
* Artikelliste
*
* 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
* 4.Image für Erzeugung von Thumbs kann gewählt werden
* Author : Evert Smit / Dirk Uptmoor / Peter Beauvain
* Copyright : None
* Created : 13-07-03
* Modified : 16-08-02 /20-09-03 upt /02-02-04 Beau
*/

// selected category
$selected2 = "CMS_VALUE[70]";
$seldir2 = "CMS_VALUE[79]";
$selimg2 = "CMS_VALUE[81]";
//funktion für die checkboxen
function d_checked2($which2) {
  if ($which2 != "") {
    return "checked";
  }
} // end function



echo "<table cellspacing=\"0\" cellpadding=\"2\" border=\"0\">
         <tr bgcolor=\"#E8E8EE\" valign=\"top\">
            <td></td>
            <td><input type=\"checkbox\" value=\"on\" ".d_checked2("CMS_VALUE[84]")." name=\"CMS_VAR[79]\"></td>
            <td width=\"120\">Ausgabe mit Startartikel</td>
            <td></td>
<td>Kategorie wählen:<br>

<select name=\"CMS_VAR[70]\">";

if($selected2!="0" && $selected2!=""){
             echo"<option value=\"0\">--- kein ---</option>";

            }else{
            echo"<option selected=\"selected\" value=\"0\">--- kein ---</option>";
            }

            // fetch all categorys
            $query = "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";
            // execute query
            $db->query($query);

            // loop result and build the options
            while ($db->next_record()) {

              // indent spacer
              $spaces2 = "|";

              // how many levels
              $levels2 = $db->f("level");

              for ($i = 0; $i < $levels2; $i ++) {
                // add 2 spaces for every level
                $spaces2 = $spaces2 . "--";

              } // end for

              $spaces2 .= ">";


              if ($selected2 == $db->f("idcat")) {
                // selected category
                echo "<option selected=\"selected\" value=\"". $db->f("idcat") ."\">". $spaces2 . $db->f("name") ."</option>";

              } else {
                // category
                echo "<option value=\"". $db->f("idcat") ."\">". $spaces2 . $db->f("name") ."</option>";

              } // end if

            } // end while

echo "</select>";



echo "</td>
<td></td>
</tr>
      <tr valign=\"top\">
         <td></td>
         <td></td>
         <td width=\"120\"></td>
            <td></td>
            <td>Überschrift: (wenn leer, keine Ausgabe)<br>
               <input type=\"text\" name=\"CMS_VAR[72]\" value=\"CMS_VALUE[72]\" size=\"24\"></td>
         </tr>
         <tr bgcolor=\"#E8E8EE\" valign=\"top\">
            <td></td>
            <td> <input type=\"checkbox\" value=\"on\" ".d_checked2("CMS_VALUE[74]")." name=\"CMS_VAR[74]\"> </td>
            <td width=\"120\">Ausgabe der Artikel-Headline</td>
            <td></td>
            <td>Angezeigte Zeichen Artikel-Headline:<br>
               <input type=\"text\" name=\"CMS_VAR[73]\" value=\"CMS_VALUE[73]\" size=\"24\"></td>
         </tr>
         <tr valign=\"top\">
            <td></td>
            <td><input type=\"checkbox\" value=\"on\" ".d_checked2("CMS_VALUE[75]")."  name=\"CMS_VAR[75]\"></td>
            <td width=\"120\">Ausgabe der Artikel-Subheadline:</td>
            <td></td>
            <td>Angezeigte Zeichen Artikel-Subheadline:<br>
               <input type=\"text\" name=\"CMS_VAR[76]\" value=\"CMS_VALUE[76]\" size=\"24\"></td>
         </tr>
         <tr valign=\"top\">
            <td></td>
            <td><input type=\"checkbox\" value=\"on\" ".d_checked2("CMS_VALUE[82]")."  name=\"CMS_VAR[82]\"></td>
            <td width=\"120\">Ausgabe der Artikel-Text:</td>
            <td></td>
            <td>Angezeigte Zeichen Artikel-Text:<br>
               <input type=\"text\" name=\"CMS_VAR[83]\" value=\"CMS_VALUE[83]\" size=\"24\"></td>
         </tr>
         <tr bgcolor=\"#E8E8EE\" valign=\"top\">
            <td></td>

            <tr bgcolor=\"#E8E8EE\" valign=\"top\">
            <td></td>
            <td><input type=\"checkbox\" value=\"on\" ".d_checked2("CMS_VALUE[77]")."  name=\"CMS_VAR[77]\" ></td>
            <td width=\"120\">Ausgabe der Thumbnails:</td>
            <td></td>
            <td>Bildcontainer für Thumbnail Quelle:<br>";


$db  = new DB_Contenido;
$query = "SELECT output AS out, name AS beschreibung FROM ".$cfg["tab"]["mod"]." ";
$db->query($query);
echo"<select name=\"CMS_VAR[81]\">";
echo"<option value=\"kein\">-- kein --</option> ";
while ($db->next_record()) {
$frontendpath2 = $db->f("out");
$name2 = $db->f("beschreibung");

$rest2 = substr("$frontendpath2", 3, 30);

$find2 = strpos($rest2,"CMS_IMG");
if ($find2 === false) {

}

else {




$ok2 = substr($rest2, $find2, 10);

$nummer2 = substr($ok2, 8, 1);


?>
            <option value="<?php echo $nummer2 ?>"<?php if ($selimg2 == $nummer2) echo " selected" ?>><?php echo $db->f("beschreibung") ?>
<?

}


}

echo" </option> </select> ";
echo"</td>

</tr>
<td></td><td></td>
<td width=\"120\">Thumbnail Ordner</td>

<td></td><td>Bitte wählen:<br><select name=\"CMS_VAR[79]\" size=\"1\">";
echo"<option value=\"kein\">-- kein --</option>";

$db  = new DB_Contenido;
$query = "SELECT DISTINCT dirname FROM ".$cfg["tab"]["upl"]." ORDER BY dirname ASC";
$db->query($query);
while ($db->next_record()) {

?>
            <option value="<?php echo $db->f("dirname") ?>"<?php if ($seldir2 == $db->f("dirname")) echo " selected" ?>><?php echo $db->f("dirname") ?></option>
<?php
   }
echo "</select></td>


<tr valign=\"top\">
<td></td>
<td></td>
<td></td>
<td></td>

</tr>
</table>
"; //Ende

Code: Alles auswählen


OUTPUT

<?
/***********************************************
* CONTENIDO MODUL - OUTPUT
*
* Erweiterte Artikel liste
*
* 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




* 4.Image für Erzeugung von Thumbs kann gewählt werden
* Author : Evert Smit / Dirk Uptmoor / Peter Beauvain
* Copyright : None
* Created : 13-07-03
* Modified : 16-08-02 /20-09-03 upt /02-02-04 Beau
************************************************/
//Frontendpfad ermitteln
$query = "SELECT frontendpath FROM ".$cfg["tab"]["clients"]." WHERE idclient='".$client."'";
$db->query($query);
$db->next_record();
$frontendpath2 = $db->f("frontendpath");



$startarton2 = "AND CATART.is_start = '0' AND";

//soll der startartikel mit ausgegeben werden?.
$print_startartikel2 = "CMS_VALUE[84]";
if($print_startartikel2 !=""){
$startarton2 = "AND";

}

//die Überschrift wird ausgegeben wenn sie nicht leer ist.
$print_mainheadline2 = "CMS_VALUE[72]";

//soll headline ausgegeben werden?
$print_headline2 = "CMS_VALUE[74]";

//soll subheadline ausgegeben werden?
$print_subheadline2 = "CMS_VALUE[75]";

//soll text ausgegeben werden?
$print_text2 = "CMS_VALUE[82]";

//soll ein thumnail ausgegeben werden?
$print_thumbnail2 = "CMS_VALUE[77]";

//thumbnail breite
$thumb2nail_width2 = "CMS_VALUE[78]";

//wenn thumbnails = 0
$image2tag2 = "";



// second db class instance
$db2 = new DB_Contenido;

// selected category
$selcat2 = "CMS_VALUE[70]";

if($selcat2!="0" && $selcat2!=""){

// select all articles in category widthout start article
$query = "SELECT ARTLANG.idart, ARTLANG.idartlang, ARTLANG.lastmodified FROM ".$cfg["tab"]["cat_art"]." AS CATART, ".
$cfg["tab"]["art_lang"]." AS ARTLANG ".
"WHERE CATART.idcat = '$selcat2' AND ARTLANG.idart = CATART.idart AND ARTLANG.idlang = '$lang' "." $startarton2 " ."ARTLANG.online = '1' ORDER BY ARTLANG.artsort limit 3";

// execute query
$db->query($query);

unset($articleID2);
unset($linkID2);

// get id's of sub articles
while ($db->next_record()) {
$articleID2[] = $db->f("idartlang");
$linkID2[] = $db->f("idart");
} // end while


/****************** start table **************************/
echo '
<span><table border="0" width=650px cellpadding="0" cellspacing="0">
<tr>
<td width="15" style="background-color: #238227;"></td>
       <td colspan="2" style="background-color: #BCBABA;" class="textklein"><i>&nbsp;News Überregional</i></td>
<!-- <td></td> -->
</tr>
</table></span>';
echo '
<table border="0" cellpadding="2" cellspacing="2" width="650px">
 ';




// Loop through articles
if (is_array($articleID2)) {
foreach ($articleID2 as $key2 => $value2) {
// select all CMS variables of the article

if($print_headline2!="0" && $print_headline2!=""){
$sql = "SELECT * FROM ".$cfg["tab"]["content"]." WHERE idartlang = '$value2' AND idtype = '1' AND typeid = '1'";

$db->query($sql);
$db->next_record();

$headline2 = urldecode($db->f("value"));

for ($j="CMS_VALUE[73]"; $j < "CMS_VALUE[73]"+20; $j++)
{
$headline21 = substr($headline2 , 0, $j);

$cut2 = substr($headline2, $j);
if ((ord ($cut2) == 32)||(ord ($cut2) == 44)||(ord ($cut2) == 45)) {

$headline2= substr($headline2 , 0, $j);
$headline2 .= ' ...';
}
}
}




$cfgTab_art_lang2 = $cfg['tab']['art_lang'];
$cfgTab_content2 = $cfg['tab']['content'];

$sql = "SELECT A.author AS author, B.lastmodified AS lastmod FROM $cfgTab_art_lang2 AS A, $cfgTab_content2 AS B WHERE A.idart='$value2' AND B.idartlang=A.idartlang ORDER BY B.lastmodified DESC";
$db->query($sql);$db->next_record();
$modifydate2= date("d.m.y",strtotime($db->f("lastmod")));
$modifytime2= date("H:i",strtotime($db->f("lastmod")));






if($print_subheadline2!="0" && $print_subheadline2!=""){
$sql_subheadline2 = "SELECT * FROM ".$cfg["tab"]["content"]." WHERE idartlang = '$value2' AND idtype = '1' AND typeid = '2'";

$db->query($sql_subheadline2);
$db->next_record();

$subheadline2 = urldecode($db->f("value"));


for ($i="CMS_VALUE[76]"; $i < "CMS_VALUE[76]"+20; $i++)
{
$subheadline21 = substr($subheadline2 , 0, $i);

$cut2 = substr($subheadline2, $i);
if ((ord ($cut2) == 32)||(ord ($cut2) == 44)||(ord ($cut2) == 45)) {

$subheadline2= substr($subheadline2 , 0, $i);
$subheadline2 .= ' ...';
}
}
}

if($print_text2!="0" && $print_text2!=""){
$sql_text2 = "SELECT * FROM ".$cfg["tab"]["content"]." WHERE idartlang = '$value2' AND idtype = '2' AND typeid = '1'";

$db->query($sql_text2);
$db->next_record();

$text2 = urldecode($db->f("value"));


for ($i="CMS_VALUE[83]"; $i < "CMS_VALUE[83]"+20; $i++)
{
$text21 = substr($text2 , 0, $i);

$cut2 = substr($text2, $i);
if ((ord ($cut2) == 32)||(ord ($cut2) == 44)||(ord ($cut2) == 45)) {

$text2= substr($text2 , 0, $i);
$text2 .= ' ...';
}
}
}



/******************* begin thumbnails **********************************/
if($print_thumbnail !="0" && $print_thumbnail !=""){ 

// select and resolve image path 
$image2sql="select value from ".$cfg["tab"]["content"]." where idartlang='$value2' and idtype='4' and typeid='CMS_value[71]'";
$db2->query($image2sql);
$db2->next_record();
$image2_id= $db2->f("value"); 


// get image name and path
$image2sql="select * from ".$cfg["tab"]["upl"]." where idupl='$image2_id'";
$db2->query($image2sql);
$db2->next_record();


$webdir2='upload/';
$thumb2dir2='CMS_value[79]';
$filedir2=$frontendpath;
$image2location2=$filedir2.$webdir2.$db2->f('dirname').$db2->f('filename');
$thumb2location2=$filedir2.$webdir2.$thumb2dir2.$db2->f('filename');
if (!file_exists($thumb2location2)){ 
// create thunbnail 
$fileinformation2=getimagesize($image2location2);
$image2width2 = $fileinformation2[0];
$image2height2 = $fileinformation2[1];
$image2type2=$db2->f('filetype');
$image2attributes2 = $fileinformation2[3];
//$newfile= $last_id."-image.".$image2type2; 
$target2=$thumb2location2;

if ( !(copy($image2location2,$target2)))
{
echo "Could not copy file to destintaion., Command returned Error Message. Please check your log files. ".$image2location2." ".$target2;
die;
}

//create thumbnails 80xrelational height; neu $thumb2nail_width x proportionale Höhe
// Determine what filetype and set pointer to source image


$original_image2=ImageCreateFromJPEG($target2);

if (!$original_image2){
echo 'Error getting image from '.$target2.'.';
}



$palette_image2 =$filedir2.$webdir2.$thumb2dir2.'vorlage.jpg';
$thumb2size2 = getImageSize($palette_image2);
$maxdim2 = $thumb2size2[0];
$draw_from2 = $image2location2;
$dim2 = GetImageSize($draw_from2);
if($dim2[0]>$dim2[1])
{
$to_w2 = $maxdim2;
$to_h2 = round($dim2[1]*($maxdim2/$dim2[0]));
$to_x2 = 0;
$to_y2 = round($maxdim2-$to_h2)/2;
}
else
{
$to_h2 = $maxdim2;
$to_w2 = round($dim2[0]*($maxdim2/$dim2[1]));
$to_y2 = 0;
$to_x2 = round($maxdim2-$to_w2)/2;
}

if($dim2[2]==1) {$from2 = ImageCreateFromGIF($draw_from2);}
elseif($dim2[2]==2) {$from2 = ImageCreateFromJPEG($draw_from2);}
elseif($dim2[2]==3) {$from2 = ImageCreateFromPNG($draw_from2);}
$thumb2 = ImageCreateFromJPEG($palette_image2);
// $set_bg_colour = ImageColorAllocate($thumb2,255,0,0);
// $fill_bg_colour = ImageFill($thumb2,0,0,$set_bg_colour);
imagecopyresampled($thumb2, $from2, $to_x2, $to_y2, 0,
0, $to_w2, $to_h2, $dim2[0], $dim2[1]);






//echo $target2;
// set image width and height of thunbnail and put pointer for filesytsem
$thumb2file= $db2->f('filename');
$target2_thumb=$thumb2location2;
$t_width2=$thumb2nail_width;
// calculating height to maintain ratio
$t_height2=($thumb2nail_width/$image2width2)*$image2height2;
// remove digits to get solid number
list ($t_height2,$notimportand)=explode('.',$t_height2);
// create blank image
$thumb2_image=imagecreatetruecolor($t_width2,$t_height2);
// $thumb2_image=imagecreate($t_width2,$t_height2);
// $thumb2_image=ImageCreateFromJPEG($palette_image2);
// resize image based on height and width
imagecopyresampled($thumb2_image,$original_image2,0,0,0,0,$t_width2,$t_height2,$image2width2,$image2height2);
// store image on file system
// requires different functionf for either gif or jpeg

imagejpeg($thumb2,$target2_thumb);

imagedestroy($thumb2);
imagedestroy($original_image2);
}
$image2=$webdir2.$thumb2dir2.$db2->f('filename');

//wenn Artikel kein Bild hat

if (!$db2->f('filename')){
$image2=$webdir2.$thumb2dir2.'vorlage.jpg';
}
//Ende

$image2tag="<img src=\" $image2 \" border=0>";

} // ende wenn keine thumbs gewünscht
/**************** Ende Thumbnails ***********************/


// link
$link = $sess->url("front_content.php?client=$client&#9001;=$lang&idcat=$selcat2&idart=$linkID2[$key2]&m=$m&s=$s");



/***********************Anfang Tablezeile für Artikelliste**********************/
echo '

<tr>
<td width="100px" align="left"><A HREF="'.$link.'">'.$image2tag2.'</a><img src=img/l.gif width=10 height=1></td>
<td class="newstext" valign="top">'.$modifydate2.' - <b>'.$headline2.'</b><br>'.$text2.' <a href="'.$link.'"><img src="upload/bilder/mehr.gif" border="0" width="15" height="15"></a></td>
</tr>

<tr>
<td colspan="2" valign="middle"><hr align="center" width="100%" noshade color="#666666" size="1"></td>
</tr>
';


} // end while



unset($headline2);
unset($headline21);
unset($subheadline2);
unset($subheadline21);
unset($text2);
unset($text2l);

} // end foreach

} // end if (is_array)

echo '</table>';
/***********************ende Table**********************/

?>


Snoopy
Beiträge: 239
Registriert: Mo 15. Sep 2003, 18:45
Kontaktdaten:

Beitrag von Snoopy » Mo 29. Mär 2004, 16:52

Da ich das Ding ja mal geschrieben habe und jetzt mit der Version 4.4.4 selbst Implementierungsprobleme habe, versucht mal folgendes wenn keine
Thumbs erzeugt werden :
Folgenden Code direkt nach dem body TAG platzieren (im Layout der News Seite)

Code: Alles auswählen

<? 
$allow_thumbs = "yes"; 
session_register("allow_thumbs"); 
?>
Gruß aus Hamburg :wink:

Harlekin
Beiträge: 16
Registriert: Mi 14. Jan 2004, 01:16
Kontaktdaten:

Beitrag von Harlekin » Mo 29. Mär 2004, 22:17

Hihi,

ist echt ein Super Module :) Bekomm nur nicht raus wie ich es machen kann, das mir die Artikel Alphabetisch aufgelistet werden... momentan werden Die Artikel nach der letzten Bearbeitung angezeigt... ich find da aber auch nix im Modul wo ich das umstellen kann, hat jemand einen Tip?

Grüße Josh

schulzi
Beiträge: 15
Registriert: Do 1. Apr 2004, 22:07
Kontaktdaten:

eigenes Datum

Beitrag von schulzi » Do 1. Apr 2004, 22:27

bartekk hat geschrieben:@Snoopy, ja habe alles in Input und output angepasst, hier der code:

(.....)

gruß

Thomas

PS: @all, habe die obige Ergänzung von Snoopy mit eingabaut
Hallo,

habe es mit diesen Änderungen sehr zu meiner zufriedenheit hinbekommen, aber wie immer bleiben Wünsche offen für PHP- und Contenido-Newbies wie mich:

Ich würde gerne wie im News-Modul von Kurt Petzuch (im Modul-Bereich) ein Datum, das bei der Artikelausgabe erscheint, frei bestimmen können, habe aber keinen Schimmer, wie ich das anstellen könnte. Aus dem Code von Kurts Modul bin ich nicht schlau geworden.

Hat jemand 'ne Idee bzw. Code für mich, wie ich eine entsprechende Datumsabfrage in den Input des o.g. Moduls einbauen kann und dann entsprechend wieder ausgebe?

@Snoopy + bartekk: Klasse Modul!

Gruß
schulzi

opu.e
Beiträge: 15
Registriert: Mi 10. Mär 2004, 13:45
Kontaktdaten:

Hilfe!

Beitrag von opu.e » Fr 2. Apr 2004, 13:23

Hallo zusammen, ich bräuchte Hilfe bei einbinden dieses Moduls!
Ich weis absolut nicht weiter, wenn ich das Modul einbinde bekomme ich immer nur eine blankpage. :(
Ich gebe zu das ich noch keine thumbs geuppt habe, aber das dürfte ja wohl nichts machen, Artikel sind vorhanden..

Gruß opu.e

schulzi
Beiträge: 15
Registriert: Do 1. Apr 2004, 22:07
Kontaktdaten:

Beitrag von schulzi » Fr 2. Apr 2004, 14:21

Ich weiß absolut nicht weiter, wenn ich das Modul einbinde bekomme ich immer nur eine blankpage.
Mit dem Original von Snoopy ging's mir exakt genauso. Mit dem geänderten Code, den Bartekk oben auf S. 2 gepostet hat, hat's dafür umso besser funktioniert. Allerdings habe ich Bilder noch nicht ausprobiert. Wenn das Template für die Seite entsprechend vorkonfiguriert ist (also lieber mit ausgeschalteten Thumbs oder Subheads, wenn keine da sind), sollte es klappen (zumind. unter 4.4.2), sonst weiß ich auch auch nicht weiter.

Gruß
schulzi

opu.e
Beiträge: 15
Registriert: Mi 10. Mär 2004, 13:45
Kontaktdaten:

Beitrag von opu.e » Fr 2. Apr 2004, 14:26

@schulzi
Danke, das hilft erstmal weiter, hatte ich nicht ausprobiert.. :oops:
Naja, bis denne. opu.e

Snoopy
Beiträge: 239
Registriert: Mo 15. Sep 2003, 18:45
Kontaktdaten:

Beitrag von Snoopy » Mo 5. Apr 2004, 15:18

@CyberDan, @kuchi der Ansatz war ja schon mal nicht schlecht !
da sich keiner erbarmt hat das mit der "Blättern Funktion" zu proggen,

habe ich dann mal noch die Seiten Navigation aus dem Gästebuch eingebaut.
Ich habe das nur in der v4.4.4 getestet, es ist aber der Programmcode, welcher auch auf
den älteren Versionen funktioniert hat.
Viel Spass damit euer Snoopy :wink:

@Karin Dähne
Es müssen also "CMS_HTMLHEAD[1]", "CMS_HTMLHEAD[2]" "CMS_HTML[1]" verwendet werden also z.B. nicht "CMS_HTML[2]".

Wo müßte ich ansetzen, um das Modul mehrfach in einem Template einsetzen zu können?
Kann ich einfach (durchgängig) die Variablenzahlen ändern?

Wie könnte ich dem Modul beibringen, sich nicht nur auf die beschiebenen "CMS_..." zu stürzen?
Das musst Du dann aber selbst programmieren, aber ein kleiner Tipp:
Schau Dir folgenden Auszug aus dem Input an:

Code: Alles auswählen

$db  = new DB_Contenido;
$query = "SELECT output AS out, name AS beschreibung FROM ".$cfg["tab"]["mod"]." "; 
$db->query($query); 
echo"<select name=\"CMS_VAR[11]\">";
echo"<option value=\"kein\">-- kein --</option> ";
while ($db->next_record()) { 
$frontendpath = $db->f("out"); 
$name = $db->f("beschreibung");

$rest = substr("$frontendpath", 3, 30); 

$find = strpos($rest,"CMS_IMG");
if ($find === false) {

}

else {
Ich lese damit aus wieviel CMS_IMG[x] es in der DB gibt, und verarbeite sie dann in einem Dropdown
Du musst das nur auf CMS_HTML[x] etc. umstricken. Wenn du dann im Output Modul die DB Abfragen machst,
musst Du dort die erzeugte CMS_VAR[x] einsetzen und zwar für idtype = '1' (die '1' steht in dem unteren Codauszug für CMS_HTMLHEAD[1])
Das würde bedeuten, das Du CMS_VALUE[x] dann anstatt dar '1' benutzen musst.
Im OUTPUT wäre das die folgende Abfrage:

Code: Alles auswählen

// 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();
    
Also viel Spass beim proggen !
Bei Erfolg hoffe ich auf Deine Veröffentlichung hier im Forum :wink:


Code:

Code: Alles auswählen

/** 
* CONTENIDO MODUL - INPUT
*
* 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 
* 4.Image für Erzeugung von Thumbs kann gewählt werden 
* Author : Evert Smit / Dirk Uptmoor / Peter Beauvain 
* Copyright : None 
* Created : 13-07-03 
* Modified : 16-08-02 /20-09-03 upt /02-02-04 Beau/04-04-04 Beau 
*/ 


// selected category
$selected = "CMS_VALUE[0]";
$seldir = "CMS_VALUE[9]";
$selimg = "CMS_VALUE[11]";
//funktion für die checkboxen
function d_checked($which) {
  if ($which != "") {
    return "checked";
  }
} // end function



echo "<table cellspacing=\"0\" cellpadding=\"2\" border=\"0\">
         
  <tr>
         <td></td> <td></td><td width=\"120\">Anzahl Einträge/Seite:   </td><td></td>
          <td><input type=\"text\" name=\"CMS_VAR[8]\" value=\"CMS_VALUE[8]\"></td></tr>

<tr bgcolor=\"#E8E8EE\" valign=\"top\">
            <td></td>
            <td><input type=\"checkbox\" value=\"on\" ".d_checked("CMS_VALUE[14]")." name=\"CMS_VAR[14]\"></td>
            <td width=\"120\">Ausgabe mit Startartikel</td>
            <td></td>
<td>Kategorie wählen:<br>
         
<select name=\"CMS_VAR[0]\">";

if($selected!="0" && $selected!=""){
             echo"<option value=\"0\">--- kein ---</option>";

            }else{
            echo"<option selected=\"selected\" value=\"0\">--- kein ---</option>";
            }

            // fetch all categorys
            $query = "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";
            // execute query
            $db->query($query);

            // loop result and build the options
            while ($db->next_record()) {

              // indent spacer
              $spaces = "|";

              // how many levels
              $levels = $db->f("level");

              for ($i = 0; $i < $levels; $i ++) {
                // add 2 spaces for every level
                $spaces = $spaces . "--";

              } // end for
             
              $spaces .= ">";


              if ($selected == $db->f("idcat")) {
                // selected category
                echo "<option selected=\"selected\" value=\"". $db->f("idcat") ."\">". $spaces . $db->f("name") ."</option>";

              } else {
                // category
                echo "<option value=\"". $db->f("idcat") ."\">". $spaces . $db->f("name") ."</option>";

              } // end if

            } // end while

echo "</select>";


       
echo "</td>
<td></td>      
</tr>
      <tr valign=\"top\">
         <td></td>
         <td></td>
         <td width=\"120\"></td>
            <td></td>
            <td>Überschrift: (wenn leer, keine Ausgabe)<br>
               <input type=\"text\" name=\"CMS_VAR[2]\" value=\"CMS_VALUE[2]\" size=\"24\"></td>
         </tr>
         <tr bgcolor=\"#E8E8EE\" valign=\"top\">
            <td></td>
            <td> <input type=\"checkbox\" value=\"on\" ".d_checked("CMS_VALUE[4]")." name=\"CMS_VAR[4]\"> </td>
            <td width=\"120\">Ausgabe der Artikel-Headline</td>
            <td></td>
            <td>Angezeigte Zeichen Artikel-Headline:<br>
               <input type=\"text\" name=\"CMS_VAR[3]\" value=\"CMS_VALUE[3]\" size=\"24\"></td>
         </tr>
         <tr valign=\"top\">
            <td></td>
            <td><input type=\"checkbox\" value=\"on\" ".d_checked("CMS_VALUE[5]")."  name=\"CMS_VAR[5]\"></td>
            <td width=\"120\">Ausgabe der Artikel-Subheadline:</td>
            <td></td>
            <td>Angezeigte Zeichen Artikel-Subheadline:<br>
               <input type=\"text\" name=\"CMS_VAR[6]\" value=\"CMS_VALUE[6]\" size=\"24\"></td>
         </tr>
         <tr bgcolor=\"#E8E8EE\" valign=\"top\">
            <td></td>
            
<tr bgcolor=\"#E8E8EE\" valign=\"top\">
            <td></td>
            <td><input type=\"checkbox\" value=\"on\" ".d_checked("CMS_VALUE[7]")."  name=\"CMS_VAR[7]\" ></td>
            <td width=\"120\">Ausgabe der Thumbnails:</td>
            <td></td>
            <td>Bildcontainer für Thumbnail Quelle:<br>";
               

$db  = new DB_Contenido;
$query = "SELECT output AS out, name AS beschreibung FROM ".$cfg["tab"]["mod"]." "; 
$db->query($query); 
echo"<select name=\"CMS_VAR[11]\">";
echo"<option value=\"kein\">-- kein --</option> ";
while ($db->next_record()) { 
$frontendpath = $db->f("out"); 
$name = $db->f("beschreibung");

$rest = substr("$frontendpath", 3, 30); 

$find = strpos($rest,"CMS_IMG");
if ($find === false) {

}

else {




$ok = substr($rest, $find, 10); 

$nummer = substr($ok, 8, 1);


?>
            <option value="<?php echo $nummer ?>"<?php if ($selimg == $nummer) echo " selected" ?>><?php echo $db->f("beschreibung") ?>
 <?

}


}

echo" </option> </select> ";














echo"</td>

</tr>
<td></td><td></td>
 <td width=\"120\">Thumbnail Ordner</td>
 
<td></td><td>Bitte wählen:<br><select name=\"CMS_VAR[9]\" size=\"1\">";
echo"<option value=\"kein\">-- kein --</option>"; 

$db  = new DB_Contenido;
$query = "SELECT DISTINCT dirname FROM ".$cfg["tab"]["upl"]." ORDER BY dirname ASC"; 
$db->query($query);
while ($db->next_record()) {
 
?> 
            <option value="<?php echo $db->f("dirname") ?>"<?php if ($seldir == $db->f("dirname")) echo " selected" ?>><?php echo $db->f("dirname") ?></option> 
<?php 
   }
echo "</select></td>


<tr valign=\"top\">
<td></td>
<td></td>
<td></td>
<td></td>

</tr>
</table>
"; //Ende
Code:

Code: 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
$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.lastmodified 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.lastmodified 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=620px 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.lastmodified 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.lastmodified 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" cellpadding="3" cellspacing="0" width="620px">
';


/**** Überschrift der Artikelliste wird ausgegeben, wenn nicht leer ********/

if($print_mainheadline !=""){
echo '
<tr>
<td colspan="2" class="headline">&nbsp;CMS_VALUE[2] <br></td>
<td align="right">  </td>
</tr>

<tr>
<td bgcolor="#ffffff" class="text">&nbsp; </td>
<td align="right" bgcolor="#ffffff"> </td>
</tr>
';
}
if($print_mainheadline ==""){
echo '
<tr>
<td colspan="2" class="headline">&nbsp;<br></td>
<td align="right">  </td>
</tr>

<tr>
<td bgcolor="#ffffff" class="text">&nbsp; </td>
<td align="right" bgcolor="#ffffff"> </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.lastmodified 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="#ffffff"><A HREF="'.$link.'">'.$imagetag.'</a></td>
<td bgcolor="#ffffff" class="newstext" valign="top">'.$subheadline.'<td valign="bottom"><a  href="'.$link.'"><img  src="upload/bilder/mehr.gif" border="0" align="right"></a></td></td>

</tr>
<tr><td bgcolor="#ffffff"><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**********************/

?>
<br><br>
Gruß aus Hamburg :wink:

ChrisD
Beiträge: 132
Registriert: Di 30. Dez 2003, 17:33
Kontaktdaten:

Beitrag von ChrisD » Di 6. Apr 2004, 10:22

Theoretisch ein sehr schönes Modul, praktisch läuft es bei mir nicht. :(
Soblad ich einen Artikel mit diesem Modul aufrufe, gibt mir der Editor eine weiße Seite aus, mit anderen Modulen läuft er aber noch.

Gruß
Chris

pansen
Beiträge: 26
Registriert: Do 26. Feb 2004, 11:57
Kontaktdaten:

Beitrag von pansen » Di 6. Apr 2004, 16:11

tach zusammen,

leider geht das modul von euch bei mir nicht so wie ich möchte. wenn ich eine menuebene auswähle, dann wird maximal die startseite angezeigt, mehr aber nicht.

jetzt habe ich das mal so umgebaut, dass wenigstens erstmal die richtigen artikel rausgesucht werden. allerdings habe ich erstens das problem:

- ich komme nicht an den html-content
- die thumbnails funktionieren nicht.

der übersichtlichkeit und der funktionalität halber habe ich alles ausgelagert, deswegen heissen auch die CMS_VAR nicht mehr so. änderungen vorgenommen an:

- sql abfragen
- links in den headlines
- html-output (auf divs verstellt, erstmal nur zum testen; wahrscheinlich aber praktischer so).

input ist wie üblich hier, outpt ist folgender:

Code: Alles auswählen

<?php
include_once($cfg["path"]["contenido"].$cfg["path"]["includes"]."functions.con.php");

$cmsvArray = array();

$cmsvArray[0] = 'CMS_VALUE[0]';
$cmsvArray[2] = 'CMS_VALUE[2]';
$cmsvArray[3] = 'CMS_VALUE[3]';
$cmsvArray[4] = 'CMS_VALUE[4]';
$cmsvArray[5] = 'CMS_VALUE[5]';
$cmsvArray[6] = 'CMS_VALUE[6]';
$cmsvArray[7] = 'CMS_VALUE[7]';
$cmsvArray[8] = 'CMS_VALUE[8]';
$cmsvArray[9] = 'CMS_VALUE[9]';
$cmsvArray[11] = 'CMS_VALUE[11]';
$cmsvArray[13] = 'CMS_VALUE[13]';
$cmsvArray[14] = 'CMS_VALUE[14]';

require('art_liste_bild_out.inc.php');

?>
hier ist der inhalt meiner zu includierenden datei:

Code: Alles auswählen

<?
/***********************************************
* CONTENIDO MODUL - OUTPUT
*
* Erweiterte Artikel liste
*
* 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
* 4.Image für Erzeugung von Thumbs kann gewählt werden
* Author : Evert Smit / Dirk Uptmoor / Peter Beauvain
* Copyright : None
* Created : 13-07-03
* Modified : 16-08-02 /20-09-03 upt /02-02-04 Beau
************************************************/

//Frontendpfad ermitteln
$query = "SELECT  frontendpath FROM ".$cfg["tab"]["clients"]." WHERE idclient='".$client."'";
$db->query($query);
$db->next_record();
$frontendpath = $db->f("frontendpath");


$startarton = "AND CATART.is_start = '0'";

//soll der startartikel mit ausgegeben werden?.
$print_startartikel = $cmsvArray[14];
if($print_startartikel !=""){
	$startarton = "";
	
}

//die Überschrift wird ausgegeben wenn sie nicht leer ist.
$print_mainheadline = $cmsvArray[2];
//soll headline ausgegeben werden?
$print_headline = $cmsvArray[4];
//soll subheadline ausgegeben werden?
$print_subheadline = $cmsvArray[5];
//soll ein thumnail ausgegeben werden?
$print_thumbnail = $cmsvArray[7];
//thumbnail breite
$thumbnail_width = $cmsvArray[8];
//wenn thumbnails = 0
$imagetag = "";



// second db class instance
$db2 = new DB_Contenido;

// selected category
$selcat = $cmsvArray[0];

if($selcat!="0" && $selcat!=""){
//------------------------------------------------------------------------------
// *** new db request ***
	$catIds = conDeeperCategoriesArray($selcat);
	
	if(is_array($catIds)){
		//abfrage für die inhalte
		unset($idcatArray);
		unset($articleID);
		unset($linkID);
		unset($articleID2);
		unset($linkID2);
		
		foreach($catIds as $key=>$val) {
			if($key != 0){
				$sql = "SELECT 
									CAT.idcat AS idcat, name 
								FROM ".
									$cfg["tab"]["cat"]." AS CAT, ".
									$cfg["tab"]["cat_lang"]." AS CATLANG
								WHERE 
									CAT.idcat = ".$val."
									AND CAT.idcat = CATLANG.idcat
									AND CATLANG.idlang = '$lang'
									AND CATLANG.visible = '1'";
				
				$db->query($sql);
				
				while ( $db->next_record() ) {
					$idcatArray[] = $db->f('idcat');
				}
				$sql = "SELECT 
									ARTLANG.idart,
									ARTLANG.idartlang,
									ARTLANG.lastmodified
								FROM " . 
									$cfg["tab"]["cat_art"] . " AS CATART, ".
									$cfg["tab"]["art_lang"]." AS ARTLANG 
								WHERE 
									CATART.idcat='" . $idcatArray[count($idcatArray)-1] . "'
									AND ARTLANG.idart = CATART.idart;";
				$db->query($sql);
				
				while ( $db->next_record() ) {
					$articleID2[] = $db->f("idartlang");
					$linkID2[] = $db->f("idart");
				}
			}
		}
	}
// *** end: new db request ***
//------------------------------------------------------------------------------

//*** old db request ***
//	require('art_liste_bild_out__old_db_request.inc.php');
//******

/****************** start output **************************/
	/**** Überschrift der Artikelliste wird ausgegeben, wenn nicht leer ********/
	if($print_mainheadline != ""){
		echo '
			<div class="headline">'.
				$cmsvArray[2].'
			</div>';
	}else if($print_mainheadline == ""){
	}
	
	// Loop through articles
	if (is_array($articleID2)) {
		foreach ($articleID2 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=$cmsvArray[3]; $j < $cmsvArray[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.lastmodified AS lastmod 
							FROM 
								$cfgTab_art_lang AS A, 
								$cfgTab_content AS B 
							WHERE 
								A.idart='$value' 
								AND B.idartlang=A.idartlang 
							ORDER BY 
								B.lastmodified 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"));
				
				
				// ** Subheadline Länge**
				for ($i=$cmsvArray[6]; $i < $cmsvArray[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 .= ' .....';
					}
				}
			}

			//******** thumbnails
			require('art_liste_bild_out__thumbnail.inc.php');			
			//******** ende thumbnails			
			
			// link
			$link = $sess->url("front_content.php?client=".$client."&lang=".$lang."&idcat=".$idcatArray[$key]);
			
			
			echo '
				<div style="border: black 1px solid; margin-top: 5px;">
					<div>
						<span class="trnews1">
							<img  src="upload/bilder/date.gif" border="0" align="right">
							<a href="' . $link . '">' . $headline . '</a>
						</span>
						<span style="align: right" class="trnews2">
							<a href="'.$link.'">'.$modifydate.'</a>
						</span>
					</div>
					<div>
						<a href="'.$link.'">'.$imagetag.'</a>
						<span class="newstext">'.
							$subheadline.'
						</span>
						<a href="' . $link . '">
						<img  src="upload/bilder/mehr.gif" border="0" align="right">
					</div>
				</div>
				';
		} // end while
		
		
		
		unset($headline);
		unset($headline1);
		unset($subheadline);
		unset($subheadline1);
		
	} // end foreach
	
} // end if (is_array)

echo '</table>';
/***********************ende Table**********************/

?> 
...und hier noch der inhalt der thumbnail-datei, welcher nicht verändert wurde, aber komplett ignoriert wird:

Code: Alles auswählen

<?php
			/******************* begin thumbnails **********************************/
			echo "thumb: " . $print_thumbnail . "<br>";
			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='".$cmsvArray[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=$cmsvArray[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(????D??T9???9?9??$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');
				$imagetag="<img src=\" $image \" border=0>";
				
			} // ende wenn keine thumbs gewünscht
			/**************** Ende Thumbnails ***********************/
?>
für irgendwelche tips wäre ich euch sehr dankbar, bin gerade ziemlich am abkacken...

andi

Gesperrt