News - Modul - Problem

Gesperrt
aspedis
Beiträge: 37
Registriert: Mo 3. Mai 2004, 16:37
Wohnort: Portland, Oregon USA
Kontaktdaten:

News - Modul - Problem

Beitrag von aspedis »

Hallo habe nach langem Hin- und Her verschiedene Lösungen des News-Moduls kombiniert.
hier der Code
_____________________________________________________________
[INPUT]

Code: Alles auswählen

/**
* 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
$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 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 valign=\"top\">
            <td></td>
            <td><input type=\"checkbox\" value=\"on\" ".d_checked("CMS_VALUE[12]")."  name=\"CMS_VAR[12]\"></td>
            <td width=\"120\">Ausgabe des Artikel-Texts:</td>
            <td></td>
            <td>Angezeigte Zeichen Artikel-Text:<br>
               <input type=\"text\" name=\"CMS_VAR[13]\" value=\"CMS_VALUE[13]\" 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
---------------------------------------------------------------------------------------------------
______________________________________________________________________
[OUTPUT]

Code: Alles auswählen

<?php

/********************************************************
* Newsmodul - OUTPUT
*
* Es wurde Code vom Modul "Artikelliste" von "(c) Author Jan Lengowski" verwendet!
*
* Author    :     Lars D. Forseth <lars@forseth.de>
* Created   :     Feb. 4th 2004
*********************************************************/


  /* number of latest articles to get */
  $anzahl = "CMS_VALUE[8]";
  if((!$anzahl) or ($anzahl < 1)) {$anzahl = 10;}
  /* length of extract */
  $laenge = "CMS_VALUE[9]";
  if((!$lange) or ($laenge <= 0)) {$laenge = 250;}
  //echo $laenge;


  // get $anzahl articles from DB
  $sql = "SELECT ARTLANG.idart, ARTLANG.title, CATART.idcat, ARTLANG.created, CONTENT.value, ".
         "CONTENT.idtype, CONTENT.typeid FROM ".$cfg["tab"]["cat_art"]." AS CATART, ".$cfg["tab"]["art_lang"].
         " AS ARTLANG, ".$cfg["tab"]["cat"]." AS CAT, ".$cfg["tab"]["content"]." AS CONTENT WHERE ".
         "ARTLANG.idart = CATART.idart AND CATART.idcat = CAT.idcat AND ARTLANG.idartlang=CONTENT.idartlang ".
         "AND CONTENT.idtype<=2 AND CONTENT.typeid<=2 AND CAT.idcat='$idcat' AND ARTLANG.idlang = '$lang' ".
         "AND ARTLANG.online = '1' AND CATART.is_start='0' ORDER BY ARTLANG.artsort ASC,ARTLANG.created ".
         "DESC";
  $db->query($sql);




  if ($db->num_rows() != 0) {

    echo "
   
    <table width=\"500\"align=\"left\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" class=\"text\">";

    $artikel = array(array());
    $j=0;
    $db->next_record();
    $idart_last=$db->f("idart");



    for ($i=0; $i < ($db->num_rows()); $i++) {
      $artikel[$j][0] = $db->f("idart");
      $artikel[$j][1] = $db->f("idcat");
      $artikel[$j][2] = substr($db->f("created"),8,2).".".substr($db->f("created"),5,2).".".substr($db->f("created"),0,4);


      while ($idart_last == $db->f("idart")) {

        if (($db->f("idtype") == 2) && ($db->f("typeid") == 1)) {

          /* filter article text */
          $html_text = strip_tags(urldecode($db->f("value")));
          $array = array ("&auml;" => "ä", "&ouml;" => "ö", "&uuml;" => "ü", "&szlig;" => "ß", "&Auml;" => "Ä", "&Ouml;" => "Ö", "&Uuml;" => "ü", "&nbsp;" => " ", """ => "\"", "<" => "<", ">" => ">", "&" => "&");
          $html_text = strtr($html_text, $array);

          for ($d=$laenge; $d < $laenge+20; $d++) {
            $cut = substr($html_text, $d);
            if ((ord ($cut) == 32)||(ord ($cut) == 44)||(ord ($cut) == 45)) {
              $html_text = substr($html_text , 0, $d);
            } // end if
          } // end for

          $html_text = htmlentities(substr($html_text,0,$laenge))." ....";
          /* search for words longer than 50 chars and shorten them + \n */
          $c = 0;
          for ($n=0; $n < strlen($html_text); $n++) {
            $c++;
            if (($html_text[$n] == " ") or ($html_text[$n] == "\n") or ($html_text[$n] == "\r")) {$c = 0;}
            if ($c > 48) {
             $html_text = substr_replace($html_text, "-\n", $n, 0);
             $n = $n+4;
             $c = 0;
            } // end if($c>45)
          } // end for
          $html_text = nl2br($html_text);
          $artikel[$j][5] = str_replace("<br />", "<br>", $html_text);

        } elseif (($db->f("idtype") == 1) && ($db->f("typeid") == 1)) {
          $artikel[$j][3] = strip_tags(urldecode($db->f("value")));
        } elseif (($db->f("idtype") == 1) && ($db->f("typeid") == 2)) {
          $artikel[$j][4] = strip_tags(urldecode($db->f("value")));
        } // end elseif

        $idart_last = $db->f("idart");
        $db->next_record();
        $i++;

      } // end while


      $idart_last = $db->f("idart");
      $j++;
      $i--;


    } // end for



    if((!$blatt) or ($blatt == "") or ($blatt < 0)) $blatt = 0;
    $blattmax = ((ceil($j/$anzahl)));
    $blatt1 = $blatt+1;


    // print articles
    for ($i=$anzahl*$blatt; $i < min($j,$anzahl*$blatt+$anzahl); $i++) {
      $k = $i-1;
      $navmod_link ="front_content.php?client=$client&lang=$lang&idcat=".$artikel[$i][1]."&idart=".$artikel[$i][0]."";
      echo "
      <tr>";
      echo "
       <td  style=\"border-bottom: Black 1px solid;\" valign=\"top\">".
       "<a href=\"".$sess->url("$navmod_link")."\"><b>".$artikel[$i][3]."</b></a>". // title of article
      "</td>".
      "<td  style=\"border-bottom: Black 1px solid;\" valign=\"top\" align=\"right\"><b>".$artikel[$i][2]."</b></td>". // date of article
     "</tr>
      <tr>".
      "<td valign=\"top\" colspan=\"2\">".$artikel[$i][5]." ". // extract of article
       "<br><div align=\"left\"><a href=\"".$sess->url("$navmod_link")."\">". // "more" link
        "<b>&raquo;&raquo; weiterlesen</b></a>".
        "</div><br>".
      "</td>
      </tr>
      ";
    } // end for



    // print page-prev- and page-next-link, if necessary
    if ($j > $anzahl) {
      echo "
      <tr>
       <td colspan=\"3\">
        <table align=\"center\" width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" class=\"text\">
         <tr valign=\"top\">".
         "<td width=\"60\" align=\"left\">";
      if ($blatt1 > 1) {
      $navmod_link ="front_content.php?client=$client&lang=$lang&idcat=$idcat&blatt=".($blatt-1)."";
      echo "
           <a href=\"".$sess->url("$navmod_link")."\"><i>&laquo; prev</i></a>";
      } else {echo " ";}
      echo "
          </td>".
         "<td align=\"center\">&ndash;&nbsp;&nbsp;Seite ".$blatt1." / ".$blattmax."&nbsp;&nbsp;&ndash;</td>".
         "<td width=\"40\" align=\"left\">";
      if ($blatt1 < $blattmax) {
      $navmod_link ="front_content.php?client=$client&lang=$lang&idcat=$idcat&blatt=".($blatt+1)."";
      echo "
           <a href=\"".$sess->url("$navmod_link")."\"><i>next &raquo;</i></a>";
      } else {echo " ";}
      echo "
          </td>".
        "</tr>
         <tr><td colspan=\"3\" height=\"15\">&nbsp;</td></tr>
        </table>
       </td>
      </tr>
      ";
    } // end if($j>$anzahl)



    echo '</table>';
  } // end if($db->num_rows() != 0)



  /* no news articles in DB */
  else {echo "<br><br><br>Momentan sind keine Artikel vorhanden...<br><br>";}


?>
--------------------------------------------------------------------------------------

anzuschauen unter
www.uni-gruen.de.vu ODER www.asta.uni-konstanz.de/hsg/gruene/

würde es gerne so ändern, dass da in Zukunft statt dem erstell-Datum das Veranstaltungsdatum erscheint. - geht das irgendwie ?

oder kann ich zumindest die Artikel nach dem Sortierschlüssel sortieren?

Vielen Dank
mfg
volker
Fürchte nicht das Chaos,
denn dadurch kann das Neue enstehen.
________________________________
Willkommen im cup-der-verlierer liebe bazis :-P
emergence
Beiträge: 10653
Registriert: Mo 28. Jul 2003, 12:49
Wohnort: Austria
Kontaktdaten:

Beitrag von emergence »

nach schnellem überfliegen...
es wird nach dem sortierschlüssel sortiert...
siehe -> LANG.artsort
schreib dort einfach das veranstaltungsdatum rein -> 20040823
dann hast du alles was du möchtest...
*** make your own tools (wishlist :: thx)
Haue
Beiträge: 43
Registriert: Mi 27. Okt 2004, 20:25
Wohnort: Emsland
Kontaktdaten:

Beitrag von Haue »

Hi, ich nutze nun obiges Modul. Ziel ist eine News-Übersicht.
In der Konfiguration der Kategorie habe ich den Ordner NEWS eingestellt. Dieser beinhaltet 5 Artikel. Leider wird mir nur "Momentan sind keine Artikel vorhanden..." dargestellt.
Hat jemand ne Idee wo dran das liegen kann?

Zu sehen hier: http://www.aga-edv.de/versen/cms/front_ ... hp?idcat=3
Halchteranerin
Beiträge: 5478
Registriert: Di 2. Mär 2004, 21:11
Wohnort: Halchter, wo sonst? ;-)
Kontaktdaten:

Beitrag von Halchteranerin »

sind die Artikel auch online gestellt?
Haue
Beiträge: 43
Registriert: Mi 27. Okt 2004, 20:25
Wohnort: Emsland
Kontaktdaten:

Beitrag von Haue »

Halchteranerin hat geschrieben:sind die Artikel auch online gestellt?
Ja, auf anderen Seiten (mit anderem Template) werden die Artikel auf der rechten Seite ja auch dargestellt.
Beispiel: http://www.aga-edv.de/versen/cms/front_ ... p?idcat=23
(rechts unter "News")
Haue
Beiträge: 43
Registriert: Mi 27. Okt 2004, 20:25
Wohnort: Emsland
Kontaktdaten:

Beitrag von Haue »

So, Fehler gefunden.
Ich hatte 2 Kategorien "News".
Natürlich dabei dann die falsche ausgewählt... :oops:
aspedis
Beiträge: 37
Registriert: Mo 3. Mai 2004, 16:37
Wohnort: Portland, Oregon USA
Kontaktdaten:

gleiches problem, andere code

Beitrag von aspedis »

hallo,
ich habe das gleiche problem nochmal bei einem anderen code (ist zusammenschnitt aus verschiedenen, thumbnail+liste)

OUTPUT: (Input ist ja egal)
<?
/***********************************************
* 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' 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 text ausgegeben werden?
$print_text = "CMS_VALUE[12]";

//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";

// 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


/****************** start table **************************/
echo '
<table border="0" cellpadding="3" cellspacing="0" width="515px"
';

/**** Ü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.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"));



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 .= ' .....';
}
}
}


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

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

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


for ($i="CMS_VALUE[13]"; $i < "CMS_VALUE[13]"+20; $i++)
{
$text1 = substr($text , 0, $i);

$cut = substr($text, $i);
if ((ord ($cut) == 32)||(ord ($cut) == 44)||(ord ($cut) == 45)) {

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

/******************* 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" ><A HREF="'.$link.'">'.$headline.'</a></td>
<td class="trnews2"><A HREF="'.$link.'">[mehr]</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.'<br>'.$text.' <td valign="bottom"><a href="'.$link.'"></a></td>
</tr>

';


} // end while

unset($headline);
unset($headline1);
unset($subheadline);
unset($subheadline1);
unset($text);
unset($textl);

} // end foreach

} // end if (is_array)

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

?>

was kann/muss ich machen, damit ich die artikel nach sortierschlüssel sortiert krieg?
habe schon versucht, eine andere lösung einzubauen, dabei hat es mir das layout völig zerschossen.
danke für eure hilfe
www.vbweb.de/cms (zum anschauen, wird verwendet bei aktuell/archiv, etc..)
Fürchte nicht das Chaos,
denn dadurch kann das Neue enstehen.
________________________________
Willkommen im cup-der-verlierer liebe bazis :-P
Mc
Beiträge: 188
Registriert: Mi 2. Mär 2005, 21:19
Kontaktdaten:

Newsmodul von aspedis

Beitrag von Mc »

Danke für das schöne Modul.

Bei mir wird allerdings bei der Anzeige des gesamten Artikels kein "Zurück-Button" angezeigt.
aspedis
Beiträge: 37
Registriert: Mo 3. Mai 2004, 16:37
Wohnort: Portland, Oregon USA
Kontaktdaten:

Beitrag von aspedis »

ja, das kommt wohl daher, dass ich den zurück-button per container einbinde.

vermute mal, das das der grund ist.

wenn noch jemand weiß, wie ich es sortieren kann???
Fürchte nicht das Chaos,
denn dadurch kann das Neue enstehen.
________________________________
Willkommen im cup-der-verlierer liebe bazis :-P
Mc
Beiträge: 188
Registriert: Mi 2. Mär 2005, 21:19
Kontaktdaten:

Beitrag von Mc »

Was muss in den Container für zurück?
Bin noch PHP-Anfänger.
Gruß Mc
aspedis
Beiträge: 37
Registriert: Mo 3. Mai 2004, 16:37
Wohnort: Portland, Oregon USA
Kontaktdaten:

Beitrag von aspedis »

hmm, also du machst ja das layout bzw die einstellungen für einen artikel mittels den templates. die wiederrum werden ja von den containern, wie im layout festgelegt, leben. will sagen, wenn du in dem template für einen artikel "headline" "subheadline" und "text" und ähnliches drin hast, must du am schluss noch in einen container ganz unten das modul "zurück" einbauen.
das modul hat bei mir folgenden code:
<?php
/***********************************************
* CONTENIDO MODUL - OUTPUT
*
* Modulname : Link auf Startartikel
* Author : Carsten Hallwachs, c.ha@gmx.de
* Copyright :
* Created : 01-07-2003
* Modified : 01-07-2003
************************************************/

$sql = "SELECT is_start FROM ".$cfg["tab"]["cat_art"]." WHERE idcat='".$idcat."' AND idart='".$idart."'";
$db->query($sql);
if ( $db->next_record() && ($db->affected_rows() != 0) ) {
if($db->f("is_start")=="1") {
echo " ";
} else {
echo '<a href="front_content.php?idcat=' . $idcat . '"> <b>&raquo;&raquo; zurück zur Übersicht</b></a>';
}
} else {
echo "Fehlender Eintrag in Tabelle cat_art!";
}
?>
ich glaube aber, das müsste fast schon dabei sein - schau mal unter module bei mir heißt das dingens "startlink".

ich bin nich wirklich gut im erklären, bastel mir auch sonst die module immer zusammen, musst einfach mal austesten.
Fürchte nicht das Chaos,
denn dadurch kann das Neue enstehen.
________________________________
Willkommen im cup-der-verlierer liebe bazis :-P
mediafuxx
Beiträge: 3
Registriert: Mi 5. Jan 2005, 22:37
Kontaktdaten:

Beitrag von mediafuxx »

Haue hat geschrieben:Hi, ich nutze nun obiges Modul. Ziel ist eine News-Übersicht.
In der Konfiguration der Kategorie habe ich den Ordner NEWS eingestellt. Dieser beinhaltet 5 Artikel. Leider wird mir nur "Momentan sind keine Artikel vorhanden..." dargestellt.
Hat jemand ne Idee wo dran das liegen kann?
Ich habe leider das gleiche Problem.
Nutze Contenido 4.4.5 mit mehreren Mandanten.
Link: http://www.mediafuxx.de/kundenseiten/li ... ontent.php

Habe das Modul schon auf einer anderen Seite eingebaut (mit nur einem Mandanten). Dort hat es wunderbar funktioniert.

Sobald ich aber mehrere Mandanten anlege und dieses Script verwenden will, zeigt er mir immer nur "Momentan sind keine Artikel vorhanden".
Die richtigen Kategorien sind ausgewählt und auch online...

Vielleicht hat jemand eine Idee?
Liegt es vielleicht an den !lang - Einstellungen? Weil ich beim Duplizieren des Mandanten die Sprache manuell in der config.php einstellen muss...

Vielen Dank im Voraus...

Euer Newbee - mediafuxx[/u]
Gesperrt