Artikelliste als 'random Teaser'

Gesperrt
mvf
Beiträge: 1758
Registriert: Mo 1. Aug 2005, 00:35
Wohnort: in der schönen Hallertau, mitten im Hopfen
Kontaktdaten:

Artikelliste als 'random Teaser'

Beitrag von mvf »

nachdem ich mit dem standard newsmodul keinen erfolg haben werde
-> http://contenido.org/forum/viewtopic.ph ... highlight=

versuche ich es nun mit der 'Artikelliste'

das random und bergenzen auf nur einen artikel, startartikel ausgenommen, funktioniert, auch wenn der inputcode noch nicht angepasst ist, aber wie bekomme ich in die query das textfeld?

z.B. noch zusätzlich

tabelle: content
feld: value
idtype: 2
typeid: 1

das problem ist das CONTENT.value schon in der query drin steht für 'headline'

wenn mir jemand mit der query hilft, dann denke ich dass ich es hinbekomme.

achso, was will ich eigetlich :) eine teaserbox die eine artikelpreview aus einer kategorie anzeigt mit headline text und mehr... die sich bei jedem agerwuest aus der kategorie einen neuen artikel sucht.

Code: Alles auswählen

<?php
$selCat  = "CMS_VALUE[0]"; // selected category
$maxChar = "CMS_VALUE[3]"; // Max. shown topic length

if (!is_numeric($maxChar) || $maxChar < 1) {
   $maxChar = "50";
}

   $maxChar2 = "150";

if(is_numeric($selCat) && $selCat != "0") {
   // select all articles in category without start article
   $query  = "SELECT CONTENT.value AS headline, ARTLANG.idart AS id, " ;
   $query .= "CATLANG.startidartlang, ARTLANG.idartlang FROM ";
   $query .= $cfg["tab"]["cat_art"]." AS CATART, ";
   $query .= $cfg["tab"]["art_lang"]." AS ARTLANG, ";
   $query .= $cfg["tab"]["cat_lang"]." AS CATLANG, ";
   $query .= $cfg["tab"]["content"]." AS CONTENT ";

   $query .= "WHERE CATART.idcat = '$selCat' AND ARTLANG.idlang = '$lang' ";
   $query .= "AND CONTENT.idartlang = ARTLANG.idartlang ";
   $query .= "AND CATLANG.idlang = ARTLANG.idlang ";
   $query .= "AND CATLANG.idcat = CATART.idcat ";

   $query .= "AND ARTLANG.idart = CATART.idart ";
   $query .= "AND ARTLANG.online = '1' ";

   if ("CMS_VALUE[6]" != "enabled") {
      $query .= "AND CATLANG.startidartlang != ARTLANG.idartlang ";
   }

   // Content-Type-Number
      $query .= "AND CONTENT.typeid = '1' ";

   // Content-Type
      $query .= "AND CONTENT.idtype = '1' ";

   $query  .= "ORDER BY RAND() LIMIT 1 ";


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

   if ($db->num_rows() > 0) {
      // Table header
      echo '<table width="165" border="0" cellspacing="0" cellpadding="0">';
      echo '<tr><td height="30" colspan="2" ></td></tr>';
      echo '<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>';
      echo '<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>';

      while ($db->next_record()) {
         $headline = urldecode($db->f("headline"));
         if (strlen($headline) > $maxChar) {
            $headline = substr($headline, 0, $maxChar);
            $headline .= '..';
         }

         $link = $sess->url("front_content.php?client=$client&lang=$lang&idcat=$selCat&idart=".$db->f("id"));
         
         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.'">'.$headline.'</a></td></tr>';
      }
      unset($headline);

      echo '</table><br>';
   } // end while
} // end if
?>
as usual,
besten dank für euren input vorab :)
Grüsse, Guido

"A common mistake that people make when trying to design something completely foolproof is to underestimate the ingenuity of complete fools."
Mostly Harmless - Douglas Adams
mvf
Beiträge: 1758
Registriert: Mo 1. Aug 2005, 00:35
Wohnort: in der schönen Hallertau, mitten im Hopfen
Kontaktdaten:

Beitrag von mvf »

habe noch eine andere variante gefunden, inder in der whileschleife das image mit ausgelesen wird ;)

Code: Alles auswählen

      <?php
$selCat     = "CMS_VALUE[0]"; // selected category
$maxChar = "CMS_VALUE[3]"; // Max. shown topic length
$str = "CMS_VALUE[2]";


if (!is_numeric($maxChar) || $maxChar < 1) {
   $maxChar = "50";
}


if(is_numeric($selCat) && $selCat != "0") {
   // select all articles in category without start article
   $query =  "SELECT CONTENT.value AS headline, ARTLANG.idart AS id, ARTLANG.lastmodified AS lastmodified, ARTLANG.modifiedby AS modifiedby FROM ";
   $query .= $cfg["tab"]["cat_art"]." AS CATART, ";
   $query .= $cfg["tab"]["art_lang"]." AS ARTLANG, ";
   $query .= $cfg["tab"]["content"]." AS CONTENT ";
   $query .= "WHERE CATART.idcat = '$selCat' ";
   $query .= "AND ARTLANG.idart != '$idart' ";
   if ("CMS_VALUE[6]" != "enabled") {
      $query .= "AND CATART.is_start = '0' ";
   }
   $query .= "AND CONTENT.idartlang = ARTLANG.idartlang ";

   // Content-Type-Number
   if (!is_numeric("CMS_VALUE[8]")) {
      $query .= "AND CONTENT.typeid = '1' ";
   } else {
      $query .= "AND CONTENT.typeid = 'CMS_VALUE[8]' ";
   }

   // Content-Type
   if (!is_numeric("CMS_VALUE[9]")) {
      $query .= "AND CONTENT.idtype = '1' ";
   } else {
      $query .= "AND CONTENT.idtype = 'CMS_VALUE[9]' ";
   }

   $query .= "AND ARTLANG.idart = CATART.idart AND ARTLANG.idlang = '$lang' ";
   $query .= "AND ARTLANG.online = '1' ORDER BY RAND() Limit 1 ";


   // LIMIT
   if (is_numeric("CMS_VALUE[10]") && "CMS_VALUE[10]" > 0) {
      $query .= "LIMIT 0, CMS_VALUE[10]";
   }

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

   if ($db->num_rows() > 0) {
   
     echo '<div class="article"><p class="nachricht">CMS_VALUE[2]<br>';
     
      while ($db->next_record()) {

         $headline = strip_tags ($headline);
         $headline = urldecode($db->f("headline"));
         $pos1 = strpos ($headline, "src");
         $pos2 = strpos ($headline, "\"",$pos1+6);
         $img = substr($headline,$pos1,$pos2-$pos1+1);
         $erstellt = date("d.m.y",strtotime($db->f("lastmodified")));
         $von = $db->f("modifiedby");
         $headline = strip_tags ($headline);
         if (strlen($headline) > $maxChar) {
           $headline = substr($headline, 0, $maxChar);
            $headline .= '...';     
       
                 }
 
         $link = $sess->url("front_content.php?client=$client&lang=$lang&idcat=$selCat&idart=".$db->f("id")."&m=$m&s=$s");
       
         echo '<span class="text"><a style="text-decoration:none;" href="' .$link. '"><img style="float:left; padding:5px;"' .$img. '  height="75px" border="0" alt="Artiekvoransicht"></a>' .capiStrTrimAfterWord ($headline, $maxChar). '...<br>';
         echo '<br>&raquo;&nbsp;<a style="font-size:10px;" href="'.$link.'">Diesen Artikel weiterlesen</a></span></p>';
         echo '<p class="footer">Artikel aktualisiert: ' .$erstellt. ' von ' .$von. '</p>';
     
     
         
      }
      unset($headline);
      echo '</div>';
   } // end while
 
} // end if
 

?>
jetzt fehlt nur noch dass sowohl CSM_HTMLHEAD[1] als auch CMS_HMTL[1] ausgelesen werden können, dann wäre das perfect.

Vieleicht findet sich ja doch noch jemand der das umsetzen kann, gefragt danach wurde ja schon vielfach :?
Grüsse, Guido

"A common mistake that people make when trying to design something completely foolproof is to underestimate the ingenuity of complete fools."
Mostly Harmless - Douglas Adams
mvf
Beiträge: 1758
Registriert: Mo 1. Aug 2005, 00:35
Wohnort: in der schönen Hallertau, mitten im Hopfen
Kontaktdaten:

Beitrag von mvf »

hallo community

ich kann es drehen und wenden wie ich wil, es funzt ned :(

gesucht wird immernoch unterstützung zur erstellung einer 'teaserbox' mit zufallsauswahl

Code: Alles auswählen

Artikelliste (ohne Startartikel)
  Ausgabe Headline
  Ausgabe Text
  Ausgabe Image
  mit Option 'ORDER BY RAND() LIMIT 1' in der query
weiterhin mreci für eure ideen und beiträge
Grüsse, Guido

"A common mistake that people make when trying to design something completely foolproof is to underestimate the ingenuity of complete fools."
Mostly Harmless - Douglas Adams
HerrB
Beiträge: 6935
Registriert: Do 22. Mai 2003, 12:44
Wohnort: Berlin
Kontaktdaten:

Beitrag von HerrB »

Guck noch mal an das Ende von diesem Thread, vielleicht hilft es:
http://www.contenido.org/forum/viewtopic.php?t=10422

Gruß
HerrB
Bitte keine unaufgeforderten PMs oder E-Mails -> use da Forum!

Newsletter: V4.4.x | V4.6.0-15 (Module, Backend) | V4.6.22+
Standardartikelliste: V4.4.x | V4.6.x
http://www.contenido.org/forum/search.php | http://faq.contenido.org | http://www.communido.net
Gesperrt