Seite 1 von 1

Falsche Verlinkung bei blätterbarer Artikelliste

Verfasst: So 4. Jun 2006, 16:47
von muddy
Hallo im Forum!

Bin vor kurzem auf Contenido gestoßen und war sofort begeistert. Klasse!!! Ein großes Lob an die Entwickler und an das Forum, in dem ich bisher immer eine Lösung zu meinen Problemen fand!

Jetzt stehe ich aber leider auf dem Schlauch! Und zwar habe ich ein Problem mit der von mir eingesetzten blätterbaren Artikelliste: Sie funktioniert ganz prima...aber leider nur auf meiner Startseite. Setze ich das Modul in einer anderen Rubrik ein, komme ich bei einem Klick auf "weiter" bzw. eine Seitenzahl immer auf die Artikelübersicht meiner Startseite.

Hat jemand eine Ahnung, wo das Problem liegen könnte?

Ich setze das folgende Modul ein:

Modulinput
[

Code: Alles auswählen

?><?php 
 /*********************************************** 
 * CONTENIDO MODUL - INPUT 
 * 
 * Modulname  :      News 
 * Author(s)   :     Andreas Lindner, 4fb 
 * Copyright   :     Contenido - four for business, Andreas Lindner 
 * Created     :     12.08.2005 
 * Modified    :     Clemens Koch, OWLweb (added page & browsing support) 
 * Date         :     20.01.2006 
 ************************************************/ 

 #Select category 
 $cms_idcat = "CMS_VALUE[1]"; 

 echo '<table cellpadding="0" cellspacing="0" border="0">'; 

 echo ' 
       <tr><td class="text_medium" style="padding:5px">Kategorie wählen: </td></tr> 
       <tr><td class="text_medium" style="padding:5px">'; 

 echo buildCategorySelect("CMS_VAR[1]", "CMS_VALUE[1]"); 
 echo '&nbsp;<input type="image" src="images/submit.gif">'; 

 echo '</td></tr>'; 

 #Select sort field and sort order 
 $sortdate = 'checked'; 
 $cms_imgsize = "CMS_VALUE[14]"; 
 $cms_limit_articles = "CMS_VALUE[15]"; 
 $cms_sort_direction = "CMS_VALUE[16]"; 
 $cms_limit_articles_per_page = "CMS_VALUE[20]"; 
 if ("CMS_VALUE[21]" != ""){ 
    $browse = "checked"; 
 } 
 if ("CMS_VALUE[17]" != '') { 
    $cms_include_start_article = ' checked'; 
 } else { 
    $cms_include_start_article = ''; 
 } 

 if ("CMS_VALUE[3]" == 'sortdate') { 
    $sortdate = 'checked'; 
    $sortnum = ''; 
 } 
 elseif ("CMS_VALUE[3]" == 'sortnum') { 
    $sortdate = ''; 
    $sortnum = 'checked'; 
 } 

 echo ' 
         <tr> 
           <td class="text_medium" style="padding:5px;">'.mi18n("Sortierung nach Datum").':</td> 
           <td style="padding:5px;"><input type="radio" name="CMS_VAR[3]" value="sortdate" '.$sortdate.'></td> 
         </tr> 
         <tr> 
           <td class="text_medium" style="padding:5px;">'.mi18n("Sortierung nach Nummer").':</td> 
           <td style="padding:5px;"><input type="radio" name="CMS_VAR[3]" value="sortnum" '.$sortnum.'></td> 
         </tr> 
         <tr> 
           <td class="text_medium" style="padding:5px;">'.mi18n("Sortierung aufsteigend").':</td> 
           <td style="padding:5px;">'; 
 if (strtolower($cms_sort_direction) == 'desc') { 
    echo '<input type="radio" name="CMS_VAR[16]" value="asc"/>'; 
 } else { 
    echo '<input type="radio" name="CMS_VAR[16]" value="asc" checked/>'; 
 } 
 echo '</td> 
         </tr> 
         <tr> 
           <td class="text_medium" style="padding:5px;">'.mi18n("Sortierung absteigend").':</td> 
           <td style="padding:5px;">'; 
 if (strtolower($cms_sort_direction) == 'desc') { 
    echo '<input type="radio" name="CMS_VAR[16]" value="desc" checked/>'; 
 } else { 
    echo '<input type="radio" name="CMS_VAR[16]" value="desc"/>'; 
 } 
 echo '</td> 
         </tr>'; 

 $noimg = ''; 
 if ("CMS_VALUE[13]" == 'true') { 
    $noimg = 'checked'; 
 } 

 #Headline 
 echo ' 
         <tr><td class="text_medium" style="padding:5px;">'.mi18n("Überschrift").': </td></tr> 
         <tr><td style="padding:5px;"><input type="text" name="CMS_VAR[4]" value="CMS_VALUE[4]"></td></tr> 
         <tr> 
           <td colspan="2" class="text_medium" style="padding:5px;"><b><u>'.mi18n("Bild für Teaser").':</u></b></td> 
         </tr> 
         <tr> 
           <td colspan="2" class="text_medium" style="padding:5px;">'.mi18n("Es wird das erste Bild des Artikels angezeigt.").'</td> 
         </tr>'; 
 #Image width 
 echo ' 
       <tr><td class="text_medium" style="padding:5px;">'.mi18n("Bildbreite").': </td></tr> 
         <tr><td style="padding:5px;"><input type="text" name="CMS_VAR[14]" value="'.$cms_imgsize.'" maxlength="3"></td></tr>'; 
 #Disable images 
 echo ' 
         <tr> 
           <td class="text_medium" style="padding:5px;">'.mi18n("Kein Bild anzeigen").':</td> 
           <td style="padding:5px;"><input type="checkbox" name="CMS_VAR[13]" value="true" '.$noimg.'></td> 
         </tr>'; 
 #Number of articles 
 echo ' 
         <tr> 
           <td class="text_medium" style="padding:5px;">'.mi18n("Anzahl Artikel begrenzen").':</td> 
           <td style="padding:5px;"><input type="text" name="CMS_VAR[15]" value="'.$cms_limit_articles.'"></td> 
         </tr>'; 
 #browsing? 
 echo ' 
         <tr> 
           <td class="text_medium" style="padding:5px;">'.mi18n("Blätterfkt?").':</td> 
           <td style="padding:5px;"><input type="checkbox" name="CMS_VAR[21]" value="true" '. $browse . '></td> 
         </tr>';        
 #Number of articles per page      
 echo ' 
         <tr> 
           <td class="text_medium" style="padding:5px;">'.mi18n("Artikel pro seite").':</td> 
           <td style="padding:5px;"><input type="text" name="CMS_VAR[20]" value="'.$cms_limit_articles_per_page.'"></td> 
         </tr>'; 
 #Include start article 
 echo ' 
         <tr> 
           <td class="text_medium" style="padding:5px;">'.mi18n("Startartikel in Liste einbeziehen").':</td> 
           <td style="padding:5px;"><input type="text" name="CMS_VAR[17]" value="yes"'.$cms_include_start_article.'></td> 
         </tr>'; 

 echo '</table>'; 
 ?><?php 

Moduloutput

Code: Alles auswählen

<?php 


 /*********************************************** 
 * CONTENIDO MODUL - OUTPUT 
 * 
 * Modulname  :      News 
 * Author(s)   :     Andreas Lindner, 4fb 
 * Copyright   :     Contenido - four for business, Andreas Lindner 
 * Created     :     12.08.2005 
 * Modified    :     Clemens Koch, OWLweb (added page & browsing support) 
 * Date         :     20.01.2006 
 ************************************************/ 

 cInclude('classes', 'class.article.php'); 
 cInclude('includes', 'functions.api.string.php'); 
 cInclude('includes', 'functions.api.images.php'); 

 if (!is_object($tpl)) { 
    $tpl = new Template; 
 } 

 $aperpage = "CMS_VALUE[20]"; 
 if ("CMS_VALUE[21]" != "") { 
    $browse = true; 
 } else { 
    $browse = false; 
 } 

 if ($aperpage == '') { 
    $aperpage = 1000; 
 } 

 $pages = 0; 

 if (!isset ($_GET["p"])) { 
    $page = 1; 
 } else { 
    $page = $_GET["p"]; 
 } 
 $tpl->reset(); 

 $sql = "SELECT 
             htmlpath, frontendpath 
         FROM 
             ".$cfg["tab"]["clients"]." 
         WHERE 
             idclient = ".$client." "; 

 $db->query($sql); 

 if ($db->next_record()) { 
    $htmlpath = $db->f('htmlpath'); 
    $frontendpath = $db->f('frontendpath'); 
 } 

 // selected category 
 $selcat = "CMS_VALUE[1]"; 
 //echo "sel $selcat<br>"; 
 $template = "teaser-standard.html"; 
 //echo "tpl $template<br>"; 
 // anzahl der zeichen text 
 $mxtext = 110; 

 $limit = "CMS_VALUE[15]"; 

 $cms_sort_direction = "CMS_VALUE[16]"; 
 if ($cms_sort_direction == '') { 
    $cms_sort_direction = 'desc'; 
 } 

 if ("CMS_VALUE[3]" == "sortdate") { 
    $order = 'lastmodified'; 
 } else { 
    $order = 'artsort'; 
 } 

 $newsheadline = "CMS_VALUE[4]"; 

 $tpl->set('s', 'TITLE', $newsheadline); 

 if (strlen($selcat) > 0 AND $selcat != '0') { 
    $options = array ('idcat' => $selcat, "start" => false, "order" => $order, "direction" => $cms_sort_direction); 

    $list = new ArticleCollection($options); 

    $count = $list->count; 

    if ($count > 0) { 
       if (is_numeric($limit) AND strlen($limit) > 0) { 
          if ($limit < $list->count) { 
             $limit_art = $limit; 
          } else { 
             $limit_art = $list->count; 
          } 
       } else { 
          $limit_art = $list->count; 
       } 

       for ($i = 0; $i < $limit_art; $i ++) { 

          if (($i % $aperpage) == 0) { 
             $pages = $pages +1; 
          } 

          $article = $list->nextArticle(); 
          if ($pages == $page) { 
             $article_id = $article->getField('idart'); 

             $teaser_img = ''; 
             if ($noimg != 'true') { 
                $text_html = $article->getContent('CMS_HTML', 1); 

                $regEx = "/<img[^>]*?>.*?/i"; 
                $match = array (); 
                preg_match($regEx, $text_html, $match); 

                $regEx = "/(src)(=)(['\"]?)([^\"']*)(['\"]?)/i"; 
                $img = array (); 
                preg_match($regEx, $match[0], $img); 
                $img_src = preg_split("/\//", $img[0]); 

                $img_name = $img_src[count($img_src) - 1]; 
                $img_name = preg_replace("/\"/", "", $img_name); 
                $img_split = preg_split("/\./", $img_name); 
                $img_type = $img_split[count($img_split) - 1]; 

                $img_split2 = preg_split("/_/", $img_split[0]); 

                $name = $img_name; 

                if (count($img_split2) > 1) { 
                   $img_x = $img_split2[count($img_split2) - 1]; 
                   $img_y = $img_split2[count($img_split2) - 2]; 

                   if (is_numeric($img_x) AND is_numeric($img_y)) { 
                      $suffix = "_".$img_x."_".$img_y.".".$img_type; 
                      $name = preg_replace("/$suffix/", "", $img_name); 
                      $name = $name.".[a-zA-Z]{3}"; 
                   } 
                } 

                $img_teaser = ''; 

                if (strlen($name) > 0) { 
                   $sql = "SELECT 
                                                                                                                                                                                                           *
                                                                                                                                                                                                       FROM 
                                                                                                                                                                                                           ".$cfg["tab"]["upl"]." 
                                                                                                                                                                                                       WHERE
                                                                                                                                                                                                           filename REGEXP '$name' "; 

                   //echo "<pre>"; print_r($sql); echo "</pre>"; 

                   $db->query($sql); 

                   if ($db->next_record()) { 
                      $filename = $db->f('filename'); 
                      $dirname = $db->f('dirname'); 
                   } 

                   $img_path = $cfgClient[$client]["upl"]["path"].$dirname.$filename; 

                   $img_size = "CMS_VALUE[14]"; 

                   $img_teaser = capiImgScale($img_path, $img_size, $img_size, $crop = false, $expand = false, $cacheTime = 1000, $wantHQ = false); 
                } // end if strlen 

                if (strlen($img_teaser) > 0) { 
                   $teaser_img = '<img src="'.$img_teaser.'" class="teaser_img">'; 
                } else { 
                   $teaser_img = ''; 
                } 

             } // end if noimg        

             $headline = strip_tags($article->getContent('CMS_HTMLHEAD', 1)); 
             $headline = str_replace($replace, " ", $headline); 

             /*            $subheadline = strip_tags($article->getContent('CMS_HTMLHEAD', 2)); 
                         $subheadline = str_replace($replace, " ", $subheadline);*/ 

             $teaserheadline = /*$subheadline."&nbsp;-&nbsp;".*/ 
             $headline; 
             $href = $sess->url("front_content.php?idcat=$selcat&idart=$article_id"); 
             $teasertext = $article->getField('summary'); 

             if (strlen(trim($teasertext)) == 0) { 
                $teasertext = strip_tags($article->getContent('CMS_HTML', 1)); 
                $teasertext2 = $teasertext; 
                $teasertext = capiStrTrimAfterWord($teasertext, $mxtext); 
                if ($teasertext != $teasertext2) { 
                   $teasertext .= '...'; 
                } 

             } // end if              
             $teasertext = $teasertext."&nbsp;".$next; 

             $tpl->set('d', 'HEADLINE', $teaserheadline); 
             $tpl->set('d', 'TEXT', $teasertext); 
             $tpl->set('d', 'HREF', $href); 
             $tpl->set('d', 'IMG', $teaser_img); 
             $tpl->set('d', 'MORE', mi18n("mehr")); 

             $tpl->next(); 
          } 
       } // end for 

       $tpl->generate('templates/'.$template); 
       $selcat = $_GET["idcat"]; 
       if ($pages != 1) { 
          $prev = $page -1; 
          $next = $page +1; 
          echo "<table><tr><td>"; 
          if ($page > 1 && $browse) { 
             $href = $sess->url("front_content.php?idcat=$selcat&p=$prev"); 
             echo "<a href=\"".$href."\">zurück</a></td><td>"; 
          } 
          for ($j = 1; $j < $pages +1; $j ++) { 
             $href = $sess->url("front_content.php?idcat=$selcat&p=$j"); 
             if ($j == $page) { 
                echo "[<b>".$j."</b>]"; 
             } else { 
                echo "[<a href=\"".$href."\">".$j."</a>]"; 
             } 
          } 
          echo "</td>"; 
          if (($pages - $page) != 0 && $browse) { 
             $href = $sess->url("front_content.php?idcat=$selcat&p=$next"); 
             echo "<td><a href=\"".$href."\">vor</a></td>"; 
          } 
          echo "</tr></table>"; 

       } 
    } 
 } 
 ?> 
Vielen Dank für Eure Hilfe + viele Grüße
muddy

P.S. ich arbeite mit Version 4.6.8 von Polycoder

Verfasst: So 4. Jun 2006, 18:43
von Halchteranerin
bitte nicht den Quelltext des Moduls sondern nur den Link zum Modul posten, falls nichts (oder nur Unwesentliches) am Code geaendert wurde.

Verfasst: Di 6. Jun 2006, 15:36
von HerrB
Wurde denn in den anderen Kategorien auch eine Konfiguration durchgeführt (Festlegung der Kategorie)?

Gruß
HerrB

Verfasst: Di 6. Jun 2006, 23:16
von muddy
Hallo HerrB,

aahhh, eine Lichtblick...eine Antwort...auch wenn`s "nur" `ne Frage ist....,

ja, in den anderen Kategorien wurde die Konfiguration korrekt durchgeführt.

Ich habe übrigens gerade eine ganz merkwürdige Entdeckung gemacht: Ich habe "weiter" bzw. eine Seitenzahl im Backend angeklickt und siehe da, die Verlinkung funktioniert im Backend in allen Rubriken tadellos!!???

Ich muss noch dazu sagen, dass ich bei diesem Projekt Contenido erstmalig nicht für die komplette Site einsetze, sondern nur für insgesamt 3 Rubriken, wobei die Navigation für diese Rubriken nicht über ein Navi-Modul gesteuert wird, sondern "ganz traditionell" angelegt wurde. Die Kategorien sind natürlich genauso angelegt, wie in einem "echten" Contenido-Projekt und sind - wie auch sämtliche Artikel - alle "online" gestellt.

Könnte das Problem eventuell etwas damit zu tun haben?

Viel Grüße von
muddy

Verfasst: Mi 7. Jun 2006, 09:20
von HerrB
Kannst Du einen Link posten (oder via PM)?

Gruß
HerrB