best practice und artikellisten

Gesperrt
kloevekorn
Beiträge: 199
Registriert: Mo 31. Okt 2005, 15:26
Wohnort: Hamburg
Kontaktdaten:

best practice und artikellisten

Beitrag von kloevekorn »

Liebe Leute,

was ist eures Erachtens best practice für folgende Aufgabenstellung, ohne zu große Modulanpassungen vornehmen zu müssen bzw. zu können.

Mitarbeiter-Kontaktdaten (Name, Position, Telefon, Bild, ....) sollen in einzelnen Artikeln pro Mitarbeiter verwaltet werden. Ein Artikellistenmodul soll die Artikel ausgeben. Die Daten sollen (außer das Bild) in Tabellen vorgehalten werden.

Mein Modell 1:
Ein Modul "Mitarbeiter", Output etwa so:

Code: Alles auswählen

echo "
CMS_IMG
<table><tr><td>Tel:</td><td>CMS_TEXT[1]</td></tr>
<tr><td>Tel:</td><td>CMS_TEXT[2]</td></tr>...
Article List Advance erlaubt es zwar, jedes einzelne CMS_xxx zu bekommen, kennt aber wohl keine Möglichkeit, die im Modul hart kodierten, umschließenden Tags mit auszugeben.
Der Vorteil dieses Modells, auch der unbegabteste Redakteur kann die Mitarbeiterdaten pflegen. Meine Kenntnisse reichen leider nicht aus, das Modul auf HTML-Templates umzustellen.

Modell 2:
ein CMS_HTML Feld, in dem der ganzeTabellen-Code und die eigentlichen Mitarbeiterdaten wie oben eingetragen wird. Also keine einzelnen CMS_xxx für Name, Tel, Fax, ....
Nachteil: Kann leicht zerschießen, unübersichtlich. Vor den Tiny-Einstellungen graut es mir.
Vorteil: Article List Advanced kann das darstellen, wenn "strip_tags" entfernt werden.

Wie würdet ihr das machen? Danke!
wosch

Beitrag von wosch »

Meine Kenntnisse reichen leider nicht aus, das Modul auf HTML-Templates umzustellen.
Aha, ...
http://www.contenido.de/forum/viewtopic ... &start=399

nur noch das Modul-Template anpassen, etwas mit strip_tags -> könnte fertig sein.

Alternative:
Es gibt ein Modul (ohne Gewähr-von mc, da habe ich auch rumgepfuscht)
Mitgliederliste oder so.
Da wollte ich etwas ähnliches mit machen wie du vorhast, habe ich aber aus den Augen verloren, müßte aber auch gehen.

Lösungen gibt es da viele ...
kloevekorn
Beiträge: 199
Registriert: Mo 31. Okt 2005, 15:26
Wohnort: Hamburg
Kontaktdaten:

Beitrag von kloevekorn »

Danke für den Hinweis auf den ArticleListAdv-Thread mit der umgebauten Liste auf Template-Basis.

Ich muss ja fünf CMS_TEXT-Platzhalter auslesen und im Template unterbringen Wenn ich richtig schaue, finde ich folgende Code-Stelle für die Zuweisung eines CMS_TEXT auf eine Variable ($artlist_text, ganz unten vollständiger output aus dem verwiesenden Thread):

Code: Alles auswählen

$artlist_text =  $aValue["i".$i]["Value"]; 
das $aValue erscheint öfters in Zusammenhang mit verschiedenen Inhalten. Ich kann aber keine Verbindung finden zwischen Artikelkonfiguration (den CMS_VALUES), dem $aValue und $artlist_text.

Gibt es da noch einen Tipp, wie ich fünf CMS_TEXT[x] in einem Artikel auslesen und unterschiedlichen Variablen zuordnen kann?

(wie die dann ins Template übertragen werden, ist mir klar)

p.s. Die Mitgliederliste kann man bestimmt noch mal brauchen. Im Moment fehlt mir die Möglichkeit, Bilder hinzuzufügen.

Code: Alles auswählen

<?php 
### Version mit korrigiertem GetImageSize Fehler 
# Initialization 
$bDebug     = false; 
$iDataStart = 20; 
$lCount     = 0; 

unset ($aData); 
$aData = array(); 

# Base settings 
unset ($aSettings); 
$aSettings = array(); 
$aSettings["ArticleCount"]       = "CMS_VALUE[0]"; 
$aSettings["ArticlePerPage"]     = "CMS_VALUE[1]"; 
$aSettings["SortBy"]             = "CMS_VALUE[2]"; 
$aSettings["SortDir"]            = "CMS_VALUE[3]"; 
$aSettings["ShowStart"]          = "CMS_VALUE[4]"; 
$aSettings["Category"]           = "CMS_VALUE[5]"; 
$aSettings["HeadlineIdentifier"] = "CMS_VALUE[7]"; 
$aSettings["HeadlineLength"]     = "CMS_VALUE[8]"; 
$aSettings["Elements"]           = "CMS_VALUE[9]"; 
$aSettings["CatTypeSel"]         = "CMS_VALUE[10]"; 
$aSettings["AddCats"]            = "CMS_VALUE[11]"; 

# Checking base settings 
if (!is_numeric($aSettings["ArticleCount"]) || $aSettings["ArticleCount"] < 0) { 
   $aSettings["ArticleCount"] = 5; 
} 
if (!is_numeric($aSettings["ArticlePerPage"]) || $aSettings["ArticlePerPage"] < 0) { 
   $aSettings["ArticlePerPage"] = 0; // Deactivating page browsing 
} 
if ($aSettings["ArticlePerPage"] == 0 || !is_numeric($_REQUEST["nextstep"])) { 
   $_REQUEST["nextstep"] = 0; 
} 
if (!is_numeric($aSettings["Category"]) || $aSettings["Category"] <= 0) { 
   $aSettings["Category"] = 0; 
} 
if (strlen($aSettings["HeadlineIdentifier"]) > 50) { 
   $aSettings["HeadlineIdentifier"] = ""; 
} 
if (!is_numeric($aSettings["HeadlineLength"]) || $aSettings["HeadlineLength"] < 0) { 
   $aSettings["HeadlineLength"] = 0; 
} 
if (!is_numeric($aSettings["Elements"]) || $aSettings["Elements"] < 0) { 
   $aSettings["Elements"] = 0; 
} 
if ($aSettings["CatTypeSel"] == "" || ($aSettings["AddCats"] == "" && $aSettings["CatTypeSel"] == "selected")) { 
   $aSettings["CatTypeSel"] = "none"; 
} 

# Detail settings 
if ($aSettings["Elements"] > 0) { 
   for ($i = 0; $i < $aSettings["Elements"]; $i++) { 
      $iElementType       = $iDataStart + ($i * 5); 
      $iElementIdentifier = $iElementType + 1; 
      $iElementWidth      = $iElementType + 2; 
      $iElementHeight     = $iElementType + 3; 

      $aSettings["k".$i] = array(); 
      $aSettings["k".$i]["ElementType"]    = "CMS_VALUE[$iElementType]"; // Text, Image, ExtractedImage 
      $aSettings["k".$i]["Identifier"]     = "CMS_VALUE[$iElementIdentifier]"; 
      $aSettings["k".$i]["ElementWidth"]   = "CMS_VALUE[$iElementWidth]"; // Textlength or ImageWidth 
      $aSettings["k".$i]["ElementHeight"]  = "CMS_VALUE[$iElementHeight]"; 

      # Check detail settings 
      if ($aSettings["k".$i]["ElementType"] == "") { 
         $aSettings["k".$i]["ElementType"] == "Text"; 
      } 
      if ($aSettings["k".$i]["ElementType"] == "Text") { 
         $aSettings["ElementHeight"] = 0; 
         if (!is_numeric($aSettings["k".$i]["ElementWidth"]) || $aSettings["k".$i]["ElementWidth"] < 0) { 
            $aSettings["k".$i]["ElementWidth"] = 50; 
         } 
      } else if (!is_numeric($aSettings["k".$i]["ElementWidth"]) || $aSettings["k".$i]["ElementWidth"] <= 0 || 
                 !is_numeric($aSettings["k".$i]["ElementHeight"]) || $aSettings["k".$i]["ElementHeight"] <= 0) { 
         $aSettings["k".$i]["ElementWidth"] = 0; 
         $aSettings["k".$i]["ElementHeight"] = 0; 
      } 
      if (strlen($aSettings["Identifier"]) > 50) { 
         $aSettings["Identifier"] = ""; 
      } 
   } 
} 

unset ($iDataStart); 
unset ($iElementType); 
unset ($iElementIdentifier); 
unset ($iElementWidth); 
unset ($iElementHeight); 

if ($aSettings["Category"] !== "0" && $aSettings["HeadlineIdentifier"] !== "") { 
   if (!is_object($db2)) { 
      $db2 = new DB_Contenido; 
   } 

   # Specifying search categories 
   $sSelCats = "'".$aSettings["Category"]."'"; 
   # Adding categories "below" primary category 
   switch ($aSettings["CatTypeSel"]) { 
      case "below": 
         $lCatLevel = -1; 
         $sql  = "SELECT a.idcat AS idcat, b.level AS level FROM ".$cfg["tab"]["cat"]." a, ".$cfg["tab"]["cat_tree"]." b "; 
         $sql .= "WHERE a.idcat = b.idcat ORDER BY b.idtree"; 

         $db2->query($sql); 
         while($db2->next_record()) { 
            if ($db2->f("idcat") == $aSettings["Category"]) { 
               $lCatLevel = $db2->f("level"); 
            } else if ($lCatLevel > -1 && $db2->f("level") > $lCatLevel) { 
               $sSelCats .= ",'".$db2->f("idcat")."'"; 
            } else if ($db2->f("level") <= $lCatLevel) { 
               break; 
            } 
         } 
         break; 
      case "selected": 
         $aCats = explode(",",$aSettings["AddCats"]); 
         foreach ($aCats as $value) { 
            if (is_numeric($value)) { 
               $sSelCats .= ",'".$value."'"; 
            } 
         } 
         break; 
      default: 
   } 

   $sql  = "SELECT tblData.value AS headline, ARTLANG.pagetitle AS pagetitle, ARTLANG.summary AS summary, ARTLANG.idart AS id, ARTLANG.lastmodified AS lastmodified, " ; 
   $sql .= "ARTLANG.created AS created, ARTLANG.published AS published, CATLANG.name AS category, "; 
   $sql .= "ARTLANG.idartlang AS idartlang, CATART.idcat AS idcat, CATART.idcatart AS idcatart FROM "; 
   $sql .= $cfg["tab"]["cat_art"]." AS CATART, "; 
   $sql .= $cfg["tab"]["art_lang"]." AS ARTLANG, "; 
   $sql .= $cfg["tab"]["cat_lang"]." AS CATLANG, "; 
   $sql .= $cfg["tab"]["content"]." AS tblData "; 

   $sql .= "WHERE CATART.idcat IN (".$sSelCats.") AND ARTLANG.idlang = '".$lang."' "; 
   $sql .= "AND tblData.idartlang = ARTLANG.idartlang "; 
   $sql .= "AND CATLANG.idlang = ARTLANG.idlang "; 
   $sql .= "AND CATLANG.idcat = CATART.idcat "; 
   $sql .= "AND ARTLANG.idart = CATART.idart "; 

   if ($aSettings["ShowStart"] != "enabled") { 
      if ($cfg["is_start_compatible"] == true) { 
         $sql .= "AND CATART.is_start = '0' "; 
      } else { 
         $sql .= "AND tblData.idartlang != CATLANG.startidartlang "; 
      } 
   } 

   $sql .= "AND ARTLANG.online = '1' "; 
   $sql .= "AND ".$aSettings["HeadlineIdentifier"]." "; 

   // Sort by 
   $sql .= "ORDER BY "; 
   $sql .= $aSettings["SortBy"]." ".$aSettings["SortDir"]." "; 

   // LIMIT 
   if ($aSettings["ArticleCount"] > 0) { 
      $sql .= "LIMIT 0, ".$aSettings["ArticleCount"]; 
   } 

   // execute query 
   $db2->query($sql); 
   $lCount = $db2->num_rows(); 

   if ($lCount > 0) { 
      if (!is_object($db3)) { 
         $db3 = new DB_Contenido; 
      } 
      if (!is_object($db4)) { 
         $db4 = new DB_Contenido; 
      } 
      if ($aSettings["ArticlePerPage"] > 0) { 
         $lStartCount = $_REQUEST["nextstep"]; 
         $lEndCount   = $_REQUEST["nextstep"] + $aSettings["ArticlePerPage"]; 
         if ($lEndCount > $lCount) { 
            $lEndCount = $lCount; 
         } 
      } else { 
         $lStartCount = 0; 
         $lEndCount   = $lCount; 
      } 

      $lRow = 0; 
      $i    = 0; 
      while ($db2->next_record()) { 
         if ( $aSettings["ShowStart"] == "enabled" || 
             ($aSettings["ShowStart"] != "enabled" && $db2->f("idartlang") != $lStartIDArtLang)) { 
            if ($lRow >= $lStartCount && $lRow < $lEndCount) { 
               $aData[$i]                        = array(); 
               $aData[$i]["Category"]            = urldecode($db2->f("category")); 
               $aData[$i]["Link"]                = $sess->url("front_content.php?idcat=".$db2->f("idcat")."&idart=".$db2->f("id"));; 
               $aData[$i]["LastModified"]        = $db2->f("lastmodified"); 
               $aData[$i]["Created"]             = $db2->f("created"); 
               $aData[$i]["Published"]           = $db2->f("published"); 
               # nachstehende Daten   Summary   eingefügt 
               $aData[$i]["Summary"]           = $db2->f("summary"); 
               # nachstehende Daten   pagetitle  eingefügt 
               $aData[$i]["Pagetitle"]           = $db2->f("pagetitle"); 

               $sTmpValue = html_entity_decode(strip_tags(urldecode($db2->f('headline')))); 
               if ($aSettings["HeadlineLength"] > 0 && strlen($sTmpValue) > $aSettings["HeadlineLength"]) { 
                  # Cutting text but preserving words and entities 
                  $sTmpValue = htmlentities(capiStrTrimAfterWord($sTmpValue, $aSettings["HeadlineLength"])."..."); 
               } 
               $aData[$i]["Headline"] = $sTmpValue; 

               if ($aSettings["Elements"] > 0) { 
                  for ($k = 0; $k < $aSettings["Elements"]; $k++) { 
                     $aData[$i]["i".$k]               = array(); 
                     $aData[$i]["i".$k]["Value"]      = ""; 
                     $aData[$i]["i".$k]["ServerPath"] = ""; 
                     $aData[$i]["i".$k]["WebPath"]    = ""; 
                     $aData[$i]["i".$k]["Width"]      = 0; 
                     $aData[$i]["i".$k]["Height"]     = 0; 
                  } 
                
                  $sql =  "SELECT tblData.value AS value, tblData.idtype AS idtype, tblData.typeid AS typeid FROM "; 
                  $sql .= $cfg["tab"]["cat_art"]." AS tblCatArt, "; 
                  $sql .= $cfg["tab"]["art_lang"]." AS tblArtLang, "; 
                  $sql .= $cfg["tab"]["content"]." AS tblData "; 
                  $sql .= "WHERE tblData.idartlang = tblArtLang.idartlang AND "; 
                  $sql .= "tblArtLang.idlang = '".$lang."' AND "; 
                  $sql .= "tblArtLang.idart = tblCatArt.idart AND "; 
                  $sql .= "tblCatArt.idcatart = '".$db2->f("idcatart")."' AND ("; 
                
                  $sql_items = ""; 
                  for ($k = 0; $k < $aSettings["Elements"]; $k++) { 
                     if ($aSettings["k".$k]["Identifier"] != "") { 
                        if ($sql_items != "") { 
                           $sql_items .= " OR (".$aSettings["k".$k]["Identifier"].")"; 
                        } else { 
                           $sql_items = "(".$aSettings["k".$k]["Identifier"].")"; 
                        } 
                     } 
                  } 
                  $sql .= $sql_items.")"; 
                  
                  if ($bDebug) { 
                     echo "<pre>".$sql."</pre>", chr(10); 
                  } 

                  // execute query 
                  $db3->query($sql); 
                  
                  while ($db3->next_record()) { 
                     $sTypeIdentifier = "tblData.idtype = '".$db3->f('idtype')."' AND tblData.typeid = '".$db3->f('typeid')."'"; 
                      
                     # Note: The TypeIdentifier for one item may be the same as for another item. 
                     #       Therefore, we are storing the content everywhere as needed 
                     for ($k = 0; $k < $aSettings["Elements"]; $k++) { 
                        if ($sTypeIdentifier == $aSettings["k".$k]["Identifier"]) { 
                           switch (TRUE) { 
                              case ($aSettings["k".$k]["ElementType"] == "Image" || $aSettings["k".$k]["ElementType"] == "ExtractedImage"): 
                                 $sql = ""; 
                                 if ($aSettings["k".$k]["ElementType"] == "Image") { 
                                    $sql =  "SELECT dirname, filename FROM ".$cfg["tab"]["upl"]." "; 
                                    $sql .= "WHERE idupl = '".$db3->f('value')."'"; 
                                 } else { 
                                    $sTmpValue = urldecode($db3->f('value')); 
    
                                    $regEx = "/<img[^>]*?>.*?/i"; 
                                    $match = array (); 
                                    preg_match($regEx, $sTmpValue, $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); 
                                    #Don't know what is happening here, exactly... 
                                    # $img_split = preg_split("/\./", $img_name); 
                                    # $img_type = $img_split[count($img_split) - 1]; 
                                    # $img_split2 = preg_split("/_/", $img_split[0]); 

                                    $name = strtolower($img_name); 

                                    #Don't know what is happening here, exactly... 
                                    #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}"; 
                                    #   } 
                                    #} 
    
                                    if (strlen($name) > 0) { 
                                       $sql =  "SELECT dirname, filename FROM ".$cfg["tab"]["upl"]." "; 
                                       $sql .= "WHERE LOWER(filename) = '$name'"; 
                                       // $sql .= "WHERE filename REGEXP '$name'"; // Old: for 'banner.jpg' 'merlin_banner.jpg' is also returned 
                                    } 
                                 } 
                              
                                 if ($bDebug) { 
                                    echo "<pre>".$sql."</pre>"; 
                                 } 
                              
                                 // execute query 
                                 if ($sql != "") { 
                                    $db4->query($sql); 
                                  
                                    if ($db4->next_record()) { 
                                       $aData[$i]["i".$k]["ServerPath"] = $cfgClient[$client]["upl"]["path"].$db4->f('dirname').$db4->f('filename'); 
                                       $aData[$i]["i".$k]["WebPath"]    = $cfgClient[$client]["upl"]["htmlpath"].$db4->f('dirname').$db4->f('filename'); 
### 
                                       list ($width, $height, $type, $attr) = getimagesize($aData[$i]["i".$k]["ServerPath"]);
                                       $aData[$i]["i".$k]["Width"]      = $width; 
                                       $aData[$i]["i".$k]["Height"]     = $height; 
                                    } 
                                 } 
                              
                                 break; 
                              default: 
                                 $sTmpValue = html_entity_decode(strip_tags(urldecode($db3->f('value')))); 
                                 if ($aSettings["k".$k]["ElementWidth"] > 0 && strlen($sTmpValue) > $aSettings["k".$k]["ElementWidth"]) { 
                                    # Cutting text but preserving words and entities 
                                    $sTmpValue = htmlentities(capiStrTrimAfterWord($sTmpValue, $aSettings["k".$k]["ElementWidth"])."..."); 
                                 } 
                                 $aData[$i]["i".$k]["Value"] = $sTmpValue; 
                           } 
                        } 
                     } 
                  } 
               } 
               $i++; 
            } else if ($lRow == $lEndCount) { 
               break; 
            } 
            $lRow++; 
         } 
      } 
      # Clearing memory 
      unset ($db2); 
      unset ($db3); 
      unset ($db4); 
      unset ($sql); 
      unset ($lStartIDArtLang); 
      unset ($lStartCount); 
      unset ($lEndCount); 

      # Output data 
      # Every output manipulation should be done here... 
      # 
      # Base information: 
      # $aSettings["Elements"]:       Number of expected, additional elements from each article 
      # $aSettings["ArticlePerPage"]: Number of articles per page (0: show all) 
      # $aSettings["k".$i]["ElementType"]:   Per Element: Type of Element: Text, Image or ExtractedImage 
      # $aSettings["k".$i]["ElementWidth"]:  Per Element: Text length or image width (-> recycling ...) 
      # $aSettings["k".$i]["ElementHeight"]: Per Element: Image width 
      # 
      # Per article: 
      # $aValue["Headline"]:          Content of article element specified as containing the headline information 
      # $aValue["Link"]:              Relative link to get to the listed article 
      # $aValue["LastModified"]:      Last modified date of the article 
      # $aValue["Created"]:           Created date of the article 
      # $aValue["Published"]:         Published date of the article 
      # $aValue["Category"]:          Category name 
      # $aValue["Summary"]:          summary Zusammenfassung 
      # $aValue["Pagetitle"]:          Seitentitel pagetitle 
      # 
      # Per article additional element: 
      # $aValue["i".$i]["Value"]:      Text (only for text elements, otherwise "") 
      # $aValue["i".$i]["WebPath"]:    HTTP... path to image 
      # $aValue["i".$i]["ServerPath"]: /server/... path to image 
      # $aValue["i".$i]["Width"]:      >Original< image width 
      # $aValue["i".$i]["Height"]:     >Original< image height 

## 
/* Init Template 
*/ 

if (!is_object($tpl)) { 
   $tpl = new Template; 
} 
$tpl->reset(); 
$template = "artlist_advanced.html"; 

## 

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

##### 

      foreach ($aData as $aValue) { 
         echo '<div id="artlist">', chr(10); 
        # echo '   <div id="headline">'.$aValue["Category"].": ".$aValue["Headline"].'</div>', chr(10); 
        # echo '   <div id="artlist_headline">'.$aValue["Headline"].'</div>', chr(10); 
        # echo '   <div id="artlist_headline"><a href="'.$aValue["Link"].'">'.$aValue["Headline"].'</a></div>', chr(10); 

##### 
        $artlist_headline = '<a href="'.$aValue["Link"].'">'.$aValue["Headline"].'</a>'; 
        # echo $artlist_headline; 
##### 
        $artlist_pagetitel = $aValue["Pagetitle"]; 
        #echo $artlist_pagetitel; 
##### 
         # echo '   <div id="artlist_zusammen">'.$aValue["Summary"].'</div>', chr(10); 
          $artlist_summary = $aValue["Summary"]; 
         # echo $artlist_summary; 

##### 
         if ($aSettings["Elements"] > 0) { 
            for ($i = 0; $i < $aSettings["Elements"]; $i++) { 
               switch (TRUE) { 
                  case ($aSettings["k".$i]["ElementType"] == "Image" || $aSettings["k".$i]["ElementType"] == "ExtractedImage"): 
                     $image = $aValue["i".$i]["WebPath"]; 
                      
                     $width  = $aValue["i".$i]["Width"]; 
                     $height = $aValue["i".$i]["Height"]; 

                     if ($aSettings["k".$i]["ElementWidth"] > 0 && $aSettings["k".$i]["ElementHeight"] > 0) { 
                        # Check, if resize necessary 
                        if ($aValue["i".$i]["ServerPath"] != "" && file_exists($aValue["i".$i]["ServerPath"]) && 
                            ($aValue["i".$i]["Width"] > $aSettings["k".$i]["ElementWidth"] || 
                             $aValue["i".$i]["Height"] > $aSettings["k".$i]["ElementHeight"])) { 
                           # Scale image 
                           $image = capiImgScale($aValue["i".$i]["ServerPath"], $aSettings["k".$i]["ElementWidth"], $aSettings["k".$i]["ElementHeight"], false, false, 10, false); 
                            
###                           #Get dimensions of the image 
                           list ($width, $height, $type, $attr) = getimagesize(str_replace($cfgClient[$client]["path"]["htmlpath"], $cfgClient[$client]["path"]["frontend"], $image)); 
                        } else { 
                           $image = $aValue["i".$i]["WebPath"]; 
                            
                           $width  = $aValue["i".$i]["Width"]; 
                           $height = $aValue["i".$i]["Height"]; 
                        } 
                     } 
                      
                     if ($image != "") { 
##### 
                       # echo '   <div id="artlist_image"><img src="'.$image.'" width="'.$width.'" height="'.$height.'" /></div>', chr(10); 
        $artlist_image = '<img src="'.$image.'" width="'.$width.'" height="'.$height.'" />'; 
         #echo $artlist_image; 
##### 
                     } 
                      
                     break; 
                  default: // Everything else is treated as "Text" 
#####-A 
                     # echo '   <div id="artlist_text">'.$aValue["i".$i]["Value"].'</div>', chr(10); 
                        #$artlist_text =  $aValue["i".$i]["Value"]; 
                        if ($artlist_summary == "") { 
                                $artlist_text =  $aValue["i".$i]["Value"]; 
                        } else { 
                                $artlist_text = $artlist_summary; 
                        } 
                      #echo $artlist_text; 

##### 
               } 
            } 
         } 
##### 
         #echo '<a href="'.$aValue["Link"].'">'.mi18n("More...").'</a>', chr(10); 
        $artlist_more = '<a href="'.$aValue["Link"].'">'.mi18n("More...").'</a>'; 
         #echo $artlist_more; 
         echo '</div>', chr(10); 

##### 
         $tpl->set('d', 'PAGETITEL', $artlist_pagetitel); 
         $tpl->set('d', 'HEADLINE', $artlist_headline); 
         $tpl->set('d', 'IMAGE',  $artlist_image); 
         $tpl->set('d', 'TEXT',  $artlist_text); 
         $tpl->set('d', 'MORE', $artlist_more); 

       $tpl->next(); 
##### 

      } 
   } 

$tpl->generate('templates/'.$template); 


   # Page browsing 
   # Hint: Number of max available records: $lCount 
   #       Number of pages: round($lCount / $aSettings["ArticlePerPage"]) 
   #       First page: nextstep=0 
   #       Last page:  nextstep=(round($lCount / $aSettings["ArticlePerPage"]) - 1) * $aSettings["ArticlePerPage"]; 
   #                   (I have to admit that I'm not sure about the last page formula ... ;-) ) 
   if ($aSettings["ArticlePerPage"] > 0) { 
      # Example: Back and Next 
      echo '<div id="browsing">', chr(10); 
      if ($_REQUEST["nextstep"] > 0) { 
         echo '   <div id="Back">', chr(10); 
         echo '      <a href="front_content.php?idcat='.$idcat.'&idart='.$idart.'&nextstep='.($_REQUEST["nextstep"]-$aSettings["ArticlePerPage"]).'">'.mi18n("Back").'</a>', chr(10); 
         echo '   </div>', chr(10); 
      } 
      if (($_REQUEST["nextstep"] + $aSettings["ArticlePerPage"]) < $lCount) { 
         echo '   <div id="Next">', chr(10); 
         echo '      <a href="front_content.php?idcat='.$idcat.'&idart='.$idart.'&nextstep='.($_REQUEST["nextstep"]+$aSettings["ArticlePerPage"]).'">'.mi18n("Next").'</a>', chr(10); 
         echo '   </div>', chr(10); 
      } 

      # Example: 1 2 3 4 5 6 7 ... 
      $iPages = intval($lCount / $aSettings["ArticlePerPage"]); 
      $sPageLinks = ''; 

      echo '   <div id="Pages">'; 
      for ($i = 1; $i <= $iPages; $i++) { 
         $lNextStep = ($i - 1) * $aSettings["ArticlePerPage"]; 
         if ($sPageLinks != '') { 
            $sPageLinks .= '&nbsp;'; 
         } 
         if ($_REQUEST["nextstep"] == $lNextStep) { 
            $sPageLinks .= $i."\n"; # I'm on the current page, no link 
         } else { 
            $sPageLinks .= '<a href="front_content.php?idcat='.$idcat.'&idart='.$idart.'&nextstep='.$lNextStep.'">'.$i.'</a>'."\n"; 
         } 
      } 
      echo '      '.$sPageLinks."\n"; 
      echo '   </div>'."\n"; 

      # Example: |< 1 ... 3 4 5 ... 8 >| 
      $iPages = intval($lCount / $aSettings["ArticlePerPage"]); 
      $sPageLinks = ''; 

      echo '   <div id="Pages">'."\n"; 
      echo '      <a href="front_content.php?idcat='.$idcat.'&idart='.$idart.'&nextstep=0">|<</a>'."\n"; 
      for ($i = 1; $i <= $iPages; $i++) { 
         $lNextStep = ($i - 1) * $aSettings["ArticlePerPage"]; 
         if ($i == 1 || $i == $iPages) { 
            if ($sPageLinks != '') { 
               $sPageLinks .= '&nbsp;'; 
            } 
            if ($_REQUEST["nextstep"] == $lNextStep) { 
               $sPageLinks .= $i."\n"; # I'm on the current page, no link 
            } else { 
               $sPageLinks .= '<a href="front_content.php?idcat='.$idcat.'&idart='.$idart.'&nextstep='.$lNextStep.'">'.$i.'</a>'."\n"; 
            } 
         } else if ($_REQUEST["nextstep"] == $lNextStep) { 
            $sPageLinks .= '&nbsp;'.$i."\n"; # I'm on the current page, no link 
         } else if ($_REQUEST["nextstep"] == ($lNextStep + $aSettings["ArticlePerPage"])) { 
            # Front 
            $sPageLinks .= '&nbsp;<a href="front_content.php?idcat='.$idcat.'&idart='.$idart.'&nextstep='.$lNextStep.'">'.$i.'</a>'."\n"; 
         } else if ($_REQUEST["nextstep"] == ($lNextStep - $aSettings["ArticlePerPage"])) { 
            # Back 
            $sPageLinks .= '&nbsp;<a href="front_content.php?idcat='.$idcat.'&idart='.$idart.'&nextstep='.$lNextStep.'">'.$i.'</a>'."\n"; 
         } else if ($_REQUEST["nextstep"] == ($lNextStep - (2 * $aSettings["ArticlePerPage"])) || 
                    $_REQUEST["nextstep"] == ($lNextStep + (2 * $aSettings["ArticlePerPage"]))) { 
            $sPageLinks .= '...'; 
         } 
      } 
      echo '      '.$sPageLinks."\n"; 
      echo '      &nbsp;<a href="front_content.php?idcat='.$idcat.'&idart='.$idart.'&nextstep='.(round($lCount / $aSettings["ArticlePerPage"]) - 1) * $aSettings["ArticlePerPage"].'">>|</a>'."\n"; 
      echo '   </div>'."\n"; 

      echo '</div>'."\n"; # Closing Browsing div 
   } 
} 
# Clearing memory 
unset ($aData); 
unset ($aSettings); 
unset ($i); 
unset ($lCount); 
unset ($bDebug); 
?>
HerrB
Beiträge: 6935
Registriert: Do 22. Mai 2003, 12:44
Wohnort: Berlin
Kontaktdaten:

Beitrag von HerrB »

Vor

Code: Alles auswählen

if ($aSettings["Elements"] > 0) {
die Zeilen

Code: Alles auswählen

$aText = array();
$iTextElement = 0;
setzen.

Nach

Code: Alles auswählen

if ($artlist_summary == "") { 
                                $artlist_text =  $aValue["i".$i]["Value"]; 
                        } else { 
                                $artlist_text = $artlist_summary; 
                        }
die Zeilen

Code: Alles auswählen

$aText[$iTextElement] = $artlist_text;
$iTextElement++;
setzen.

Die Zeile

Code: Alles auswählen

$tpl->set('d', 'TEXT',  $artlist_text);
durch

Code: Alles auswählen

for ($i = 0; $i < $iTextElement; $i++) {
   $tpl->set('d', 'TEXT' . $i,  $aText[$i]);
}
ersetzen.

Nun im Template die Platzhalter TEXT0, ..., TEXTn (n = natürliche Zahl) vorsehen.

Ungetestet.

Gruß
HerrB

Nach
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
wosch

Beitrag von wosch »

Frage:
HerrB hat geschrieben:Die Zeile

Code: Alles auswählen

$tpl->set('d', 'TEXT',  $artlist_text);
durch

Code: Alles auswählen

for ($i = 0; $i < $iTextElement; $i++) {
   $tpl->set('d', 'TEXT' . $i,  $aText[$i]);
}
ersetzen.
muß es da nicht heißen:
durch

Code: Alles auswählen

for ($i = 0; $i < $iTextElement; $i++) {
   $tpl->set('d', 'TEXT' . $i,  $artlist_text[$i]);
}
ersetzen
kloevekorn
Beiträge: 199
Registriert: Mo 31. Okt 2005, 15:26
Wohnort: Hamburg
Kontaktdaten:

Beitrag von kloevekorn »

Danke Herr B und an alle anderen Mitdenker.

Hat gleich beim ersten Einbau funktioniert. Große Klasse, das!

Der Vollständigkeit halber:
bei dem hier:

Code: Alles auswählen

if ($aSettings["Elements"] > 0) {
ist das dritte Auftreten gemeint.

Jetzt bleiben bei Artikellisten kaum noch Wünsche offen. Außer natürlich, ich will unbedingt das dritte Bild innerhalb einen CMS_HTML :wink:

Als Service: das passende Template "artlist_advanced.html" .... nein nicht valide und überhaupt, aber damit man ne Idee hat und nicht suchen muss:

Code: Alles auswählen

<h1 class="content">{TITLE}</h1> 
<!-- BEGIN:BLOCK --> 
<div style="padding-bottom:10px;"> 
<TABLE> 
<TR> 
<TD ALIGN="LEFT" VALIGN="TOP" WIDTH="100"><B><FONT COLOR="#FF0000">{PAGETITEL}</FONT></B></TD> 
<TD ALIGN="LEFT" VALIGN="TOP" WIDTH="5"></TD> 
<TD ALIGN="LEFT" VALIGN="TOP"><B>{HEADLINE}</B></A></TD> 
</TR> 
<TR> 
<TD ALIGN="LEFT" VALIGN="TOP">{IMAGE}</TD><TD ALIGN="LEFT" VALIGN="TOP"></TD> 
<TD ALIGN="LEFT" VALIGN="TOP"><BR>{TEXT0}<BR><BR>{TEXT1}<BR><BR>{TEXT2}<BR><BR>{TEXT3}<BR><BR>{TEXT4}<BR><BR>{TEXT5}<BR>
<BR><B>{MORE}</B></TD> 
</TR> 
</TABLE> 
</div><P></P> 
<!-- END:BLOCK -->
kloevekorn
Beiträge: 199
Registriert: Mo 31. Okt 2005, 15:26
Wohnort: Hamburg
Kontaktdaten:

Beitrag von kloevekorn »

Ich habe ein kleines Problem mit Bildern in der Artikelliste Advanced,

Beispiel: nur im ersten Artikel ist ein Bild vorhanden, dann wird dieses Bild auch in allen Folgeartikeln von der ALA ausgegeben. Sind im ersten und zweiten Artikel Bilder, wird das Bild aus dem zweiten Artikel in allen Folgeartikeln ausgegeben (Folgeartikel wahrscheinlich im Sinne der Sortierung) Bei anderen Elementen, z.B. CMS_TEXT werden leere Felder nicht vom Vorartikel ausgefüllt.

Ich habe zur Lösung versucht, je am Anfang bzw. am Ende die Bildervariable zu leeren (und natürlich das Forum befragt), leider ohne Erfolg:

$artlist_image = "";
$image = "";
unset($artlist_image);

Jeweils ohne Erfolg ... Schnapsidee? Wie löscht man die Bildinfo aus den Vorartikeln? :cry:
wosch

Beitrag von wosch »

kloevekorn hat geschrieben: Jeweils ohne Erfolg ... Schnapsidee? Wie löscht man die Bildinfo aus den Vorartikeln? :cry:
Wahrscheinlich wird, so wie du schreibst, die Varibale $artlist_image nicht geleert.
Ich weiß auch nicht was für einen Wert $image zurückliefert wenn keine Grafik vorhanden ist.

Nimm mal aus diesem Block:

Code: Alles auswählen

##### 
                       # echo '   <div id="artlist_image"><img src="'.$image.'" width="'.$width.'" height="'.$height.'" /></div>', chr(10); 
        $artlist_image = '<img src="'.$image.'" width="'.$width.'" height="'.$height.'" />'; 
         #echo $artlist_image; 
##### 
beide # vor den 2 Zeilen raus und schau mal wie das Ergebnis aussieht.
Ob nur $artlist_image oder auch $image dargestellt wird.
kloevekorn
Beiträge: 199
Registriert: Mo 31. Okt 2005, 15:26
Wohnort: Hamburg
Kontaktdaten:

Beitrag von kloevekorn »

Danke für deinen Vorschlag Wosch. Ich muss dieses Spezialproblem aber nochmal verschieben, werde aber mittelfristig nochmal draufschauen müssen.
Gesperrt