Titel statt Headline in der Artikelliste

Gesperrt
Andreas
Beiträge: 254
Registriert: So 16. Nov 2003, 14:48
Wohnort: Reichshof
Kontaktdaten:

Titel statt Headline in der Artikelliste

Beitrag von Andreas »

Hallo zusammen,

ich würde gern in der Artikelliste nicht die Headline, sondern den Titel (der aus der Artikel-Konfiguration) als Link ausgeben.
Im Forum gibt es ein paar Ansätze, aber damit komme ich nicht wirklich klar... :(
Hat vielleicht jemand eine Idee?

Hier der Output des Moduls:

Code: Alles auswählen

<?php

// 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 CATART.is_start = '0' AND ". 
         "ARTLANG.online = '1' order by ARTLANG.created DESC LIMIT 0,5";

// 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="150" border="0" cellspacing="0" cellpadding="0" style="background-color: #E4E4E4; border-left: 1px solid #B4B4B4; border-top: 1px solid #B4B4B4; border-right: 1px solid #B4B4B4;"><tr><td class="title_newsbox"><div align="center">CMS_VALUE[2]</div></td></tr></table>';

echo '<table width="150" border="0" cellspacing="0" cellpadding="0" style="background-color: #FFFFFF; border: 1px solid #B4B4B4; padding-top:5px; padding-bottom:5px">';
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 = urldecode($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 class="newsbox"><a href="'.$link.'">'.$head.'</a></td></tr>';

    } // end while



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

echo ' </table><img src=\"upload/layout/space.gif\" width=\"150\" height=\"10\">';
?>
Danke im voraus.

Andreas
emergence
Beiträge: 10653
Registriert: Mo 28. Jul 2003, 12:49
Wohnort: Austria
Kontaktdaten:

Beitrag von emergence »

Code: Alles auswählen

// 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 CATART.is_start = '0' AND ". 
         "ARTLANG.online = '1' order by ARTLANG.created DESC LIMIT 0,5";
durch

Code: Alles auswählen

// select all articles in category widthout start article 
$query = "SELECT ARTLANG.title,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 CATART.is_start = '0' AND ". 
         "ARTLANG.online = '1' order by ARTLANG.created DESC LIMIT 0,5";
und

Code: Alles auswählen

while ($db->next_record()) { 
  $articleID[] = $db->f("idartlang"); 
  $linkID[] = $db->f("idart"); 
} // end while 
durch

Code: Alles auswählen

while ($db->next_record()) { 
  $articleID[] = $db->f("idartlang"); 
  $articleTitle[] = $db->f("title"); 
  $linkID[] = $db->f("idart"); 
} // end while 

Code: Alles auswählen

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

Code: Alles auswählen

          $head = $articleTitle[$key];
ersetzen...

habs zwar nicht getestet, sollte aber laufen...
*** make your own tools (wishlist :: thx)
Gesperrt