Seite 1 von 1

Artikelliste (?) bringt mich an Rand der Verzweiflung....

Verfasst: Mi 5. Nov 2003, 19:19
von saschar
Hallo.
Hat jemand eine Ahnung wie ich die Artikelliste so abändern kann,
dass sie mir statt den Headlines den Seitentitel ausgibt.

Krieg das einfach nicht gebacken und habe jetzt schon Stunder
herumgedoktort....

Danke
und Gruß
Sascha

Verfasst: Mi 5. Nov 2003, 20:28
von emergence
wie sieht dein modul aus, das du verwendest ?

Verfasst: Mi 5. Nov 2003, 20:59
von saschar
Input:

Code: Alles auswählen

// selected category
$selected = "CMS_VALUE[0]";

echo "<table cellspacing=\"0\" cellpadding=\"10\" border=\"0\">
        <tr valign=\"top\">
          <td>Kategorie wählen:</td>
          <td>
            <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>
        </tr>
        <tr>
          <td>Überschrift</td>
          <td><input type=\"text\" name=\"CMS_VAR[2]\" value=\"CMS_VALUE[2]\"></td>
        </tr>
        <tr>
          <td>Angezeigte Länge in Zeichen</td>
          <td><input type=\"text\" name=\"CMS_VAR[3]\" value=\"CMS_VALUE[3]\"></td>
        </tr>

      </table>";
Output

Code: Alles auswählen

<?
// 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>
';

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();

 //         $head = $db->f("value");
$titel = $db->f("title");
          $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.'">'.$titel.'</a><BR>'.$summary;

    } // end while
echo '</TD></TR>';


          unset($head);
        unset($summary);
        
    } // end foreach
    
} // end if (is_array)

echo '</table><br>';

?>

Verfasst: Mi 5. Nov 2003, 21:12
von emergence
na ja du kannst nur werte anzeigen lassen die auch mit rausselektiert werden...

verwende diesen code im outputbereich

Code: Alles auswählen

          // select all CMS variables of the article 
          $sql = "SELECT ".$cfg["tab"]["content"].".*,".$cfg["tab"]["art_lang"].".summary,".$cfg["tab"]["art_lang"].".title    
                  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'";

Danke, es funktioniert aber immer noch nicht...

Verfasst: Do 6. Nov 2003, 09:41
von saschar
Komme eigentlich auf das genau gleiche Ergebnis...

Es zeigt mir zwar die Aufzählungspunkte an, jedoch nicht den Seitentitel.
Ich habe die Module Terminübersicht und Termin Ein-und Ausgabe in Verwendung.
Ich habe für Konzerte, Theater eigene Kategorien angelegt und wollte auf der Startseite eine Artikelliste mit den Seiten der jeweiliugen Kategorie darstellen.

Er zeigt mir die Kategorie an und eben auch die Aufzählungszeichen, allerdings zeigt er dort aber auch ein Aufzählungssymbol für die Startseite an.

Aber Danke auf jeden Fall mal für die Hilfe...

Gruß
Sascha[/img]

verstehe die artikelliste nicht :(

Verfasst: So 18. Apr 2004, 23:36
von bishop
hallo!

ich bin neu in der welt der cms und habe versucht mich nach und nach in contenido einzuarbeiten. leider ist das letzte mal wo ich etwas mit sql gemacht habe lange zeit her, daher will es mir einfach nicht gelingen die standardausgabe der artikelliste von headlines auf seitentitel umzustellen.

ich habe mich durch mehrere varianten die hier im forum gepostet wurden bereits probiert, doch leider ohne erfolg.

zum schluss entdeckte ich diesen thread und voller freude stürzte ich mich auf den von emergence geposteten code-schnipsel.

ergebnis blieb leider das selbe... die seitentitel werden nicht angezeigt.

ich seh den wald vor lauter bäumen nicht :shock:

könnte mir evtl. jemand helfen und mir sagen, wo ich was wie abändern muss damit ich anstelle der headlines die seitentitel der einzelnen artikel aufgelistet bekomme? wäre zutiefst dankbar.

verwendete contenido version: 4.4.2
verwendete artikelliste ist die aus dem beispiel mandanten.

ich liste sie dennoch nachfolgend nochmal mit auf, zum besseren verständnis.

eingabe / input

Code: Alles auswählen

/**
* Artikelliste mit I1,H1,T1
*
* Erstellt eine Liste mit allen Artikel bis
* auf den Startartikel.
*
* INPUT
*
* Author Jan Lengowski
* Copyright four for business AG
*/

// selected category
$selected = "CMS_VALUE[0]";

echo "<table cellspacing=\"0\" cellpadding=\"10\" border=\"0\">
        <tr valign=\"top\">
          <td>Kategorie wählen:</td>
          <td>
            <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>
        </tr>
        <tr>
          <td>Überschrift</td>
          <td><input type=\"text\" name=\"CMS_VAR[2]\" value=\"CMS_VALUE[2]\"></td>
        </tr>
        <tr>
          <td>Angezeigte Länge in Zeichen</td>
          <td><input type=\"text\" name=\"CMS_VAR[3]\" value=\"CMS_VALUE[3]\"></td>
        </tr>

      </table>";
ausgabe / output

Code: Alles auswählen

<?php
/***********************************************
* CONTENIDO MODUL - OUTPUT
*
* REFERENZ MODUL / ARTIKELLISTE
*
* Artikelliste mit Img 1, Head 1, Head 2
*
* Erstellt eine Liste mit allen Artikel bis
* auf den Startartikel.
*
* Author      :     Jan Lengowski
* Copyright   :     four for business AG
* Created     :     15-08-2002
* 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="165" border="0" cellspacing="0" cellpadding="0">
<tr><td height="30" colspan="2" ></td></tr>
<tr><td height="21" width="22" style="border: 0px; border-top:1px; border-bottom:1px; border-color: #F7C473; border-style: solid; background-color: #FCF2D5"><img src="images/wuerfel.gif" width="22" height="21" border="0"></td>
<td width="143" style="border: 1px; border-left:0px; border-color: #F7C473; border-style: dashed; background-color: #FCF2D5; padding-left:10px" class="punkte">CMS_VALUE[2]</td></tr>
';

if (is_array($articleID)) {

    foreach ($articleID as $key => $value) {

          // select all CMS variables of the article
          $sql = "SELECT * FROM ".$cfg["tab"]["content"]." WHERE idartlang = '$value' AND idtype = '1' AND typeid = '1'";
          $db->query($sql);
          $db->next_record();
          $head = $db->f("value");

          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 colspan="2" class="text" height="22" style="border: 1px; border-top:0px; border-color: #F7C473; border-style: dashed; background-color: #FCF2D5; padding-left:10px"><a href="'.$link.'">'.urldecode($db->f("value")).'</a></td></tr>';

    } // end while



          unset($headline);
        unset($text);
        
    } // end foreach
    
} // end if (is_array)

echo '</table><br>';


?>
laut datum der kommentare wurde wohl seit 2002 nichts an der syntax geändert... leider habe ich nichts im forum gefunden was mir auf die sprünge half :(

ich bedanke mich im voraus :)

Verfasst: Mo 19. Apr 2004, 03:31
von bishop
so, ich glaube ich habe nun eine lichtung in den dunklen wald geschlagen :lol:

nachfolgender code im ausgabe / output fenster hat mir die gewünschten resultate gebracht:

Code: Alles auswählen

<?php
/***********************************************
* CONTENIDO MODUL - OUTPUT
*
* REFERENZ MODUL / ARTIKELLISTE
*
* Artikelliste mit Img 1, Head 1, Head 2
*
* Erstellt eine Liste mit allen Artikel bis
* auf den Startartikel.
*
* Author      :     Jan Lengowski
* Copyright   :     four for business AG
* Created     :     15-08-2002
* 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="165" border="0" cellspacing="0" cellpadding="0">
<tr><td height="30" colspan="2" ></td></tr>
<tr><td height="21" width="22" style="border: 0px; border-top:1px; border-bottom:1px; border-color: #F7C473; border-style: solid; background-color: #FCF2D5"><img src="images/wuerfel.gif" width="22" height="21" border="0"></td>
<td width="143" style="border: 1px; border-left:0px; border-color: #F7C473; border-style: dashed; background-color: #FCF2D5; padding-left:10px" class="punkte">CMS_VALUE[2]</td></tr>
';

if (is_array($articleID)) {

    foreach ($articleID as $key => $value) {

          // select all CMS variables of the article
          /* $sql = "SELECT * FROM ".$cfg["tab"]["content"]." WHERE idartlang = '$value' AND idtype = '1' AND typeid = '1'"; */
          $sql = "SELECT * FROM ".$cfg["tab"]["art_lang"]." WHERE idartlang = '$value' ORDER BY idartlang DESC";

          $db->query($sql);
          $db->next_record();
          $head = $db->f("title");

          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 colspan="2" class="text" height="22" style="border: 1px; border-top:0px; border-color: #F7C473; border-style: dashed; background-color: #FCF2D5; padding-left:10px"><a href="'.$link.'">'.urldecode($db->f("title")).'</a></td></tr>';
          

    } // end while



          unset($headline);
        unset($text);
        
    } // end foreach
    
} // end if (is_array)

?>
falls jemand verbesserungsvorschläge zur absicherung der queries hat, immer her damit... wie gesagt, bin da nicht mehr so ganz konfirm drin und muss mich erst wieder reinfitzen :)