Seite 3 von 5

Verfasst: Sa 8. Okt 2005, 23:42
von HerrB
Nein, da der Code immer nur Kategorie A ausgeben sollte. Ich habe keine Ahnung, woher nur das A kommt...

Und wenn Du mehr Artikel anlegst, erhältst Du das Spielchen für jeden Artikel?

Gruß
HerrB

Doppelte anzeige

Verfasst: Sa 8. Okt 2005, 23:45
von Darki
JA bekomme es für jeden artikel :roll:
er schreibt mir immer die Kategori mit ? ohhman ich hoffe das ich mal weiter komm mit dem SQL hab ich immer noch nicht verstanden

:lol: Übrigens danke für die Schnelle antwort

Code: Alles auswählen

if ($gefunden) { 
         $gesamt[$suchindex][] = array('suche' => $suche, 'titel' => $titel, 'kategorie' => $kategorie, 'artikel' => $artikel, '[b]abteilung[/b]' => [b]$abteilung); [/b]
      } else { 
         $gesamt['@'][] = array('suche' => $suche, 'titel' => $titel, 'kategorie' => $kategorie, 'artikel' => $artikel, 'abteilung' => $abteilung); 
      } 
   } 

   echo '            <tr><td align="right" colspan="3" class="liste">'; 
   for ($i = 0; $i < 14; $i++) { 
      $text = strtoupper($liste[$i]); 

      if (is_array($gesamt[ $liste[$i] ])) { 
         $text = '<a href="#'.$text.'" class="liste">'.$text.'</a>'; 
      } 

      echo $text.'&nbsp;'; 
   } 
   echo '</td></tr> 
            <tr><td align="right" colspan="3" class="liste">'; 
   for ($i = 14; $i < 28; $i++) { 
      $text = strtoupper($liste[$i]); 

      if (is_array($gesamt[ $liste[$i] ])) { 
         $text = '<a href="#'.$text.'" class="liste">'.$text.'</a>'; 
      } 
kann es an abteilung liegen ?

Verfasst: So 9. Okt 2005, 00:05
von HerrB
Ich sage ja, ich habe keine Ahnung. Die Daten werden hier gesammelt:

Code: Alles auswählen

$suche = klein($db->f("value")); 
      $suchindex = substr($suche, 0, 1); 
      $titel = urldecode($db->f("value")); 
      $artikel = $db->f("idart"); 
      $kategorie = $db->f("idcat"); 
      $abteilung = $db->f("name"); 
Man sieht, $abteilung ist Name der Kategorie. Die Ausgabe erfolgt hier:

Code: Alles auswählen

$text = strtoupper($buchstabe);
echo '            <tr><td colspan="3" width="'.$textspalteplus.'"><img src="images/dotclear.gif" width="'.$textspalteplus.'" height="20" alt=""></td></tr> 
            <tr> 
               <td valign="top" width="'.$breiterand.'">&nbsp;</td> 
               <td valign="top" width="'.$breitekomplett.'" valign="top"><a name="'.$text.'"></a>'.$text.'</td> 
               <td valign="top" width="'.$breiterand.'">&nbsp;</td> 
            </tr> 
'; 

         foreach ($gesamt[$buchstabe] as $eintrag) { 
            $link = $sess->url("front_content.php?idcat=".$eintrag['kategorie']."&idart=".$eintrag['artikel'].$sessionid); 

            echo '            <tr> 
               <td valign="top" width="'.$breiterand.'">&nbsp;</td> 
               <td valign="top" width="'.$breitekomplett.'" valign="top"><a href="'.$link.'" class="liste_headlinelink">'.$eintrag['titel'].'</a> ('.$eintrag['abteilung'].')</td> 
               <td valign="top" width="'.$breiterand.'">&nbsp;</td> 
            </tr> 
Es werden ausgegeben: $text (ist der Buchstabe), $eintrag['titel'] (ist irgendein Inhalt aus dem Artikel) und $eintrag['abteilung'] (der Name der Kategorie) - und das einzige Element in Klammern.

Wie gesagt, ich habe keine Idee. Was ist "Kategorie A" vs. "A"? Wenn Kategorie A "hubbabubba" lautet, was ist dann A?

Kannst Du mal einen Screenshot der Kategorien liefern?

Gruß
HerrB

klap noch nicht

Verfasst: Di 25. Okt 2005, 10:07
von Darki
Hallo und Sorry das ich mich solange nicht gemeldet hab

an bei meine Kategorien

-Glossar Inhalt
Kategorie A
Kategorie B

und hir meine AUSGABE

0-9 A B C D E F G H I J K L M
N O P Q R S T U V W X Y Z @
Dieses Glossar enthält 4 Artikel.

A
A Test01 (A)
A Test01 (Kategorie A)


B
BBS (B)
BBS (Kategorie B)

jetz ist meine Frage wieso ich ein und den selben artikel 2fach angezeigt bekomme und ich es beheben kann die
[/code]

Hilfe

Verfasst: Mi 2. Nov 2005, 19:56
von Darki
KAnn nimat mir sagen was ich verkehrt mach :lol:

Verfasst: Mi 2. Nov 2005, 20:21
von HerrB
Nein, ehrlich gesagt, nicht. Tut mir leid.

Ich kann Dir z.Z. leider nicht helfen (V4.6...).

Gruß
HerrB

kategorie nicht anzeigen

Verfasst: So 19. Feb 2006, 21:08
von Mc
Danke für das tolle Modul. Funktioniert auch sehr gut.
Ich habe die Kategorie, in der sich die Artikel befinden, offline gesetzt.
Wenn nun aber über das Glossar ein entsprechender Artikel geöffnet wird, dann wird ein entsprechender Menüpunkt der geschützten Kategorie in der Navigation geöffnet. Zwar ohne Inhalt aber praktisch als Platzhalter.

Hat jemand eine Idee, wie dies zu verhindern ist?
Vielen Dank.

Mc

Glossar unter 4.6.8

Verfasst: Di 16. Mai 2006, 13:43
von Aixtraweb
Hallo!

Das Modul läuft bei mir, soweit nur unter der neuen Version klappt es mit den Links aus dem ABC im Kopfbereich nicht mehr...

0-9 A B C D E F G H I J K L M
N O P Q R S T U V W X Y Z @

klickt man auf einen Buchstaben lande ich auf meiner Fehlerseite, anstelle auf den Textlink/Index der Seite, der Link der übergeben wird sieht so aus http://www.mein-foto-abc.de/cms/#A - müste es nicht ungefähr so lauten: http://www.mein-foto-abc.de/cms/front_c ... idcat=25#A ???

Da ich noch stets kein PHP etc. kann, welche Veränderung muss durchgeführt werden für die neue Contenido Version 4.6.8??

Code: Alles auswählen

Beschreibung

Für das Glossar muss eine Oberkategorie erzeugt werden. 
Darunter legt man für jeden Anfangsbuchstaben eine Kategorie an. 
$parentcatid ist die idcat der Oberkategorie. 
$cmstypeid ist die interne ID des Content-Typs, 2 ist z.B. CMS_HTML.
$numberofcmstype ist die Nummer, die im Textmodul hinter dem Contenttyp steht, z.B. 1 bei CMS_HTML[1]. 

Code: Alles auswählen


Output

<?php 

$parentcatid = 25; 
$cmstypeid = 1; 
$numberofcmstype = 1; 

echo "<!-- Modul: Glossarliste -->\n"; 

function klein($text) { 
   $text = urldecode($text); 

   $text = strip_tags($text, ""); 

//   $text = str_replace(" ", "_", $text); 
   $text = str_replace(":", "_", $text); 
   $text = str_replace("(", "_", $text); 
   $text = str_replace(")", "_", $text); 
   $text = str_replace("[", "_", $text); 
   $text = str_replace("]", "_", $text); 
   $text = str_replace("'", "_", $text); 
   $text = str_replace('"', '_', $text); 

   $text = strtolower($text); 

   $text = str_replace("ä", "ae", $text); 
   $text = str_replace("ö", "oe", $text); 
   $text = str_replace("ü", "ue", $text); 
   $text = str_replace("ß", "ss", $text); 

   return $text; 
} 

$db = new DB_Contenido; 
$db2 = new DB_Contenido; 

$breiterand = 0; 
$breitekomplett = 500 - 2 * $breiterand; 

$liste = array("0-9", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "@"); 

foreach ($liste as $buchstabe) { 
   $gesamt[$buchstabe] = ""; 
} 

// liest die anzahl betroffener artikel aus der datenbank 
$sql = "SELECT count(*) AS anzahl FROM ".$cfg['tab']['cat']." AS a LEFT JOIN ".$cfg['tab']['cat_art']." AS b ON a.idcat = b.idcat LEFT JOIN ".$cfg['tab']['art_lang']." AS c ON b.idart = c.idart LEFT JOIN ".$cfg['tab']['content']." AS d ON c.idartlang = d.idartlang LEFT JOIN ".$cfg['tab']['cat_lang']." AS e ON a.idcat = e.idcat WHERE a.parentid = ".$parentcatid." AND d.idtype = '".$cmstypeid."' AND d.typeid = '".$numberofcmstype."' AND d.value != '';"; 
$db->query($sql); 
$db->next_record(); 
$anzahl_artikel = $db->f("anzahl"); 

if ($anzahl_artikel > 0) { 
   $sql = "SELECT d.value, b.idart, b.idcat, e.name FROM ".$cfg['tab']['cat']." AS a LEFT JOIN ".$cfg['tab']['cat_art']." AS b ON a.idcat = b.idcat LEFT JOIN ".$cfg['tab']['art_lang']." AS c ON b.idart = c.idart LEFT JOIN ".$cfg['tab']['content']." AS d ON c.idartlang = d.idartlang LEFT JOIN ".$cfg['tab']['cat_lang']." AS e ON a.idcat = e.idcat WHERE a.parentid = ".$parentcatid." AND d.idtype = '".$cmstypeid."' AND d.typeid = '".$numberofcmstype."' AND d.value != '';"; 
   $db->query($sql); 

   while ($db->next_record()) { 
      $suche = klein($db->f("value")); 
      $suchindex = substr($suche, 0, 1); 
      $titel = urldecode($db->f("value")); 
      $artikel = $db->f("idart"); 
      $kategorie = $db->f("idcat"); 
      $abteilung = $db->f("name"); 

      $gefunden = false; 

      foreach ($liste as $value) { 
         $wert = ord($suchindex); 
         if (($wert > 47) && ($wert < 57)) 
            $suchindex = "0-9"; 

         if ($value == $suchindex) { 
            $gefunden = true; 
            break; 
         } 
      } 

      if ($gefunden) { 
         $gesamt[$suchindex][] = array('suche' => $suche, 'titel' => $titel, 'kategorie' => $kategorie, 'artikel' => $artikel, 'abteilung' => $abteilung); 
      } else { 
         $gesamt['@'][] = array('suche' => $suche, 'titel' => $titel, 'kategorie' => $kategorie, 'artikel' => $artikel, 'abteilung' => $abteilung); 
      } 
   } 

   echo '<table><tr><td align="right" colspan="3" class="liste">'; 
   for ($i = 0; $i < 14; $i++) { 
      $text = strtoupper($liste[$i]); 

      if (is_array($gesamt[ $liste[$i] ])) { 
         $text = '<a href="#'.$text.'" class="liste">'.$text.'</a>'; 
      } 

      echo $text.'&nbsp;'; 
   } 
   echo '</td></tr> 
            <tr><td align="right" colspan="3" class="liste">'; 
   for ($i = 14; $i < 28; $i++) { 
      $text = strtoupper($liste[$i]); 

      if (is_array($gesamt[ $liste[$i] ])) { 
         $text = '<a href="#'.$text.'" class="liste">'.$text.'</a>'; 
      } 

      echo $text.'&nbsp;'; 
   } 
   echo '</td></tr> 
            <tr><td colspan="3" class="text">Das ABC enth&auml;lt zur Zeit '.$anzahl_artikel.' Artikel.</td></tr> 
'; 

   foreach ($liste as $buchstabe) { 
      if (is_array($gesamt[$buchstabe])) { 
         sort($gesamt[$buchstabe]); 

         $text = strtoupper($buchstabe); 

         echo '<tr><td colspan="3" width="'.$textspalteplus.'"><img src="upload/bilder/dotclear.gif" width="'.$textspalteplus.'" height="20" alt=""></td></tr> 
            <tr> 
               <td valign="top" width="'.$breiterand.'">&nbsp;</td> 
               <td valign="top" width="'.$breitekomplett.'" valign="top"><a name="'.$text.'"></a>'.$text.'<hr width="100%" size="1" noshade></td> 
               <td valign="top" width="'.$breiterand.'">&nbsp;</td> 
            </tr> 
'; 

         foreach ($gesamt[$buchstabe] as $eintrag) { 
            $link = $sess->url("front_content.php?idcat=".$eintrag['kategorie']."&idart=".$eintrag['artikel'].$sessionid); 

            echo '<tr> 
               <td valign="top" width="'.$breiterand.'">&nbsp;</td> 
               <td valign="top" width="'.$breitekomplett.'" valign="top"><a href="'.$link.'" class="liste_headlinelink">'.$eintrag['titel'].'</a><font class="klein"> ('.$eintrag['abteilung'].')</font></td> 
               <td valign="top" width="'.$breiterand.'">&nbsp;</td> 
            </tr> 
'; 
         } 
      echo '<tr> 
               <td valign="top" width="'.$breiterand.'">&nbsp;</td> 
               <td valign="top" width="'.$breitekomplett.'">&nbsp;</td> 
               <td valign="top" width="'.$breiterand.'">&nbsp;</td> 
            </tr> 
'; 
      } 
   } 

} else { 
   echo '<tr> 
               <td valign="top" width="'.$breiterand.'">&nbsp;</td> 
               <td valign="top" align="center" width="'.$breitekomplett.'">Dieses Glossar enth&auml;lt leider noch keine Artikel.</td> 
               <td valign="top" width="'.$breiterand.'">&nbsp;</td> 
            </tr> 
            <tr> 
               <td valign="top" width="'.$breiterand.'">&nbsp;</td> 
               <td valign="top" width="'.$breitekomplett.'">&nbsp;</td> 
               <td valign="top" width="'.$breiterand.'">&nbsp;</td> 
            </tr>
'; 
} 
echo '</table>';
unset ($breiterand); 
unset ($breitekomplett); 

?> 



Verfasst: Mi 13. Dez 2006, 17:35
von Snuppel007
Ich benutze auch diese Modul "Glossarliste" unter Contenido Release: 4.6.15. Bei mir zeigt es im Kopfbereich zwar das ABC ... Z an, aber ich kann keins anklicken ...?

Könnt Ihr mir helfen???

Code: Alles auswählen

<?php 

$parentcatid = 57; 
$cmstypeid = 2; 
$numberofcmstype = 1; 

echo "<!-- Modul: Glossarliste -->\n"; 

function klein($text) { 
   $text = urldecode($text); 

   $text = strip_tags($text, ""); 

//   $text = str_replace(" ", "_", $text); 
   $text = str_replace(":", "_", $text); 
   $text = str_replace("(", "_", $text); 
   $text = str_replace(")", "_", $text); 
   $text = str_replace("[", "_", $text); 
   $text = str_replace("]", "_", $text); 
   $text = str_replace("'", "_", $text); 
   $text = str_replace('"', '_', $text); 

   $text = strtolower($text); 

   $text = str_replace("ä", "ae", $text); 
   $text = str_replace("ö", "oe", $text); 
   $text = str_replace("ü", "ue", $text); 
   $text = str_replace("ß", "ss", $text); 

   return $text; 
} 

function unterkategorien($kategorie) { 
   global $cfg, $unterkat; 
   $unterkat[] = $kategorie; 

   $db = new DB_Contenido; 
   $sql = "SELECT idcat FROM {$cfg['tab']['cat']} WHERE parentid = '".$kategorie."' ORDER BY idcat ASC;"; 
   $db->query($sql); 

   while ($db->next_record()) { 
      unterkategorien($db->f("idcat")); 
   } 
} 

$db = new DB_Contenido; 
$db2 = new DB_Contenido; 

$breiterand = 5; 
$breitekomplett = 200 - 2 * $breiterand; 

$liste = array( "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "@"); 

foreach ($liste as $buchstabe) { 
   $gesamt[$buchstabe] = ""; 
} 

$unterkat = array(); 
unterkategorien($parentcatid); 

// liest die anzahl betroffener artikel aus der datenbank 
$sql = "SELECT count(*) AS anzahl FROM ".$cfg['tab']['cat']." AS a LEFT JOIN ".$cfg['tab']['cat_art']." AS b ON a.idcat = b.idcat LEFT JOIN ".$cfg['tab']['art_lang']." AS c ON b.idart = c.idart LEFT JOIN ".$cfg['tab']['content']." AS d ON c.idartlang = d.idartlang LEFT JOIN ".$cfg['tab']['cat_lang']." AS e ON a.idcat = e.idcat WHERE a.parentid IN (".implode(", ", $unterkat).") AND d.idtype = '".$cmstypeid."' AND d.typeid = '".$numberofcmstype."' AND d.value != '';"; 
$db->query($sql); 
$db->next_record(); 
$anzahl_artikel = $db->f("anzahl"); 

if ($anzahl_artikel > 0) { 
   $sql = "SELECT d.value, b.idart, b.idcat, e.name FROM ".$cfg['tab']['cat']." AS a LEFT JOIN ".$cfg['tab']['cat_art']." AS b ON a.idcat = b.idcat LEFT JOIN ".$cfg['tab']['art_lang']." AS c ON b.idart = c.idart LEFT JOIN ".$cfg['tab']['content']." AS d ON c.idartlang = d.idartlang LEFT JOIN ".$cfg['tab']['cat_lang']." AS e ON a.idcat = e.idcat WHERE a.parentid IN (".implode(", ", $unterkat).") AND d.idtype = '".$cmstypeid."' AND d.typeid = '".$numberofcmstype."' AND d.value != '';"; 
   $db->query($sql); 

   while ($db->next_record()) { 
      $suche = klein($db->f("value")); 
      $suchindex = substr($suche, 0, 1); 
      $titel = urldecode($db->f("value")); 
      $artikel = $db->f("idart"); 
      $kategorie = $db->f("idcat"); 
      $abteilung = $db->f("name"); 

      $gefunden = false; 

      foreach ($liste as $value) { 
         $wert = ord($suchindex); 
         if (($wert > 47) && ($wert < 57)) 
            $suchindex = "0-9"; 

         if ($value == $suchindex) { 
            $gefunden = true; 
            break; 
         } 
      } 

      if ($gefunden) { 
         $gesamt[$suchindex][] = array('suche' => $suche, 'titel' => $titel, 'kategorie' => $kategorie, 'artikel' => $artikel, 'abteilung' => $abteilung); 
      } else { 
         $gesamt['@'][] = array('suche' => $suche, 'titel' => $titel, 'kategorie' => $kategorie, 'artikel' => $artikel, 'abteilung' => $abteilung); 
      } 
   } 

   echo ' <tr><td colspan="3" class="glossliste">'; 
   for ($i = 0; $i < 26; $i++) { 
      $text = strtoupper($liste[$i]); 

      if (is_array($gesamt[ $liste[$i] ])) { 
         $text = '<a href="#'.$text.'" class="liste">'.$text.'</a>'; 
      } 

      echo $text.'&nbsp;'; 
   } 
    
   echo '</td></tr> 
            <tr><td colspan="3" class="text">Dieses Telefonbuch enth&auml;lt '.$anzahl_artikel.' Artikel.</td></tr> 
'; 

   foreach ($liste as $buchstabe) { 
      if (is_array($gesamt[$buchstabe])) { 
         sort($gesamt[$buchstabe]); 

         $text = strtoupper($buchstabe); 

         echo '            <tr><td colspan="3" width="'.$textspalteplus.'"><img src="images/dotclear.gif" width="'.$textspalteplus.'" height="20" alt=""></td></tr> 
            <tr> 
               <td valign="top" width="'.$breiterand.'">&nbsp;</td> 
               <td valign="top" width="'.$breitekomplett.'" valign="top"><a name="'.$text.'"></a>'.$text.'</td> 
               <td valign="top" width="'.$breiterand.'">&nbsp;</td> 
            </tr> 
'; 

         foreach ($gesamt[$buchstabe] as $eintrag) { 
            $link = $sess->url("front_content.php?idcat=".$eintrag['kategorie']."&idart=".$eintrag['artikel'].$sessionid); 

            echo '            <tr> 
               <td valign="top" width="'.$breiterand.'">&nbsp;</td> 
               <td valign="top" width="'.$breitekomplett.'" valign="top"><a href="'.$link.'" class="liste_headlinelink">'.$eintrag['titel'].'</a> ('.$eintrag['abteilung'].')</td> 
               <td valign="top" width="'.$breiterand.'">&nbsp;</td> 
            </tr> 
'; 
         } 
      echo '            <tr> 
               <td valign="top" width="'.$breiterand.'">&nbsp;</td> 
               <td valign="top" width="'.$breitekomplett.'">&nbsp;</td> 
               <td valign="top" width="'.$breite.'">&nbsp;</td> 
            </tr> 
'; 
      } 
   } 

} else { 
   echo '            <tr> 
               <td valign="top" width="'.$breiterand.'">&nbsp;</td> 
               <td valign="top" align="center" width="'.$breitekomplett.'">Dieses Glossar enth&auml;lt leider noch keine Artikel.</td> 
               <td valign="top" width="'.$breiterand.'">&nbsp;</td> 
            </tr> 
            <tr> 
               <td valign="top" width="'.$breiterand.'">&nbsp;</td> 
               <td valign="top" width="'.$breitekomplett.'">&nbsp;</td> 
               <td valign="top" width="'.$breiterand.'">&nbsp;</td> 
            </tr> 
'; 
} 

unset ($breiterand); 
unset ($breitekomplett); 

?> 
[/quote]

Verfasst: Mi 13. Dez 2006, 21:05
von Mc
Hast du denn Artikel angelegt?
Unter 4.6.15 läuft es auch, habe aber mit der Zweisprachigkeit Probleme.

siehe http://www.webec.de

Gruß Mc

Verfasst: Mi 13. Dez 2006, 22:09
von Snuppel007
Hallo Mc,

... webec.de genauso will ich das auch!
Ja, hab zwei artikel angelegt, diese werden auch angezeigt, nur die Kopfleiste will nicht arbeiten.

Gruß, Oleg

Verfasst: Do 14. Dez 2006, 19:37
von Mc
Probier mal dieses Modul. Kann aber sein, dass es das gleiche ist.

Gruß Mc

Code: Alles auswählen

<?php 

$parentcatid = 18; 
$cmstypeid = 1; 
$numberofcmstype = 1; 

echo "<!-- Modul: Glossarliste -->\n"; 
echo "<table ...>\n";

function klein($text) { 
   $text = urldecode($text); 

   $text = strip_tags($text, ""); 

//   $text = str_replace(" ", "_", $text); 
   $text = str_replace(":", "_", $text); 
   $text = str_replace("(", "_", $text); 
   $text = str_replace(")", "_", $text); 
   $text = str_replace("[", "_", $text); 
   $text = str_replace("]", "_", $text); 
   $text = str_replace("'", "_", $text); 
   $text = str_replace('"', '_', $text); 

   $text = strtolower($text); 

   $text = str_replace("ä", "ae", $text); 
   $text = str_replace("ö", "oe", $text); 
   $text = str_replace("ü", "ue", $text); 
   $text = str_replace("ß", "ss", $text); 

   return $text; 
} 

function unterkategorien($kategorie) { 
   global $cfg, $unterkat; 
   $unterkat[] = $kategorie; 

   $db = new DB_Contenido; 
   $sql = "SELECT idcat FROM {$cfg['tab']['cat']} WHERE parentid = '".$kategorie."' ORDER BY idcat ASC;"; 
   $db->query($sql); 

   while ($db->next_record()) { 
      unterkategorien($db->f("idcat")); 
   } 
} 

$db = new DB_Contenido; 
$db2 = new DB_Contenido; 

$breiterand = 5; 
$breitekomplett = 200 - 2 * $breiterand; 

$liste = array("0-9", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "@"); 

foreach ($liste as $buchstabe) { 
   $gesamt[$buchstabe] = ""; 
} 

$unterkat = array(); 
unterkategorien($parentcatid); 

// liest die anzahl betroffener artikel aus der datenbank 
$sql = "SELECT count(*) AS anzahl FROM ".$cfg['tab']['cat']." AS a LEFT JOIN ".$cfg['tab']['cat_art']." AS b ON a.idcat = b.idcat LEFT JOIN ".$cfg['tab']['art_lang']." AS c ON b.idart = c.idart LEFT JOIN ".$cfg['tab']['content']." AS d ON c.idartlang = d.idartlang LEFT JOIN ".$cfg['tab']['cat_lang']." AS e ON a.idcat = e.idcat WHERE a.parentid IN (".implode(", ", $unterkat).") AND d.idtype = '".$cmstypeid."' AND d.typeid = '".$numberofcmstype."' AND d.value != '';"; 
$db->query($sql); 
$db->next_record(); 
$anzahl_artikel = $db->f("anzahl"); 

if ($anzahl_artikel > 0) { 
   $sql = "SELECT d.value, b.idart, b.idcat, e.name FROM ".$cfg['tab']['cat']." AS a LEFT JOIN ".$cfg['tab']['cat_art']." AS b ON a.idcat = b.idcat LEFT JOIN ".$cfg['tab']['art_lang']." AS c ON b.idart = c.idart LEFT JOIN ".$cfg['tab']['content']." AS d ON c.idartlang = d.idartlang LEFT JOIN ".$cfg['tab']['cat_lang']." AS e ON a.idcat = e.idcat WHERE a.parentid IN (".implode(", ", $unterkat).") AND d.idtype = '".$cmstypeid."' AND d.typeid = '".$numberofcmstype."' AND d.value != '';"; 
   $db->query($sql); 

   while ($db->next_record()) { 
      $suche = klein($db->f("value")); 
      $suchindex = substr($suche, 0, 1); 
      $titel = urldecode($db->f("value")); 
      $artikel = $db->f("idart"); 
      $kategorie = $db->f("idcat"); 
      $abteilung = $db->f("name"); 

      $gefunden = false; 

      foreach ($liste as $value) { 
         $wert = ord($suchindex); 
         if (($wert > 47) && ($wert < 57)) 
            $suchindex = "0-9"; 

         if ($value == $suchindex) { 
            $gefunden = true; 
            break; 
         } 
      } 

      if ($gefunden) { 
         $gesamt[$suchindex][] = array('suche' => $suche, 'titel' => $titel, 'kategorie' => $kategorie, 'artikel' => $artikel, 'abteilung' => $abteilung); 
      } else { 
         $gesamt['@'][] = array('suche' => $suche, 'titel' => $titel, 'kategorie' => $kategorie, 'artikel' => $artikel, 'abteilung' => $abteilung); 
      } 
   } 

   echo '            <tr><td align="left" colspan="3" class="glossar">'; 
   for ($i = 0; $i < 28; $i++) { 
      $text = strtoupper($liste[$i]); 

      if (is_array($gesamt[ $liste[$i] ])) { 
         $text = '<a href="front_content.php?idcat=17#'.$text.'" class="glossar">'.$text.'</a>'; 
      } 

      echo $text.'&nbsp;&nbsp;'; 
   }
 
/*   echo '</td></tr> 
            <tr><td align="left" colspan="3" class="glossar">'; 
   for ($i = 14; $i < 28; $i++) { 
      $text = strtoupper($liste[$i]); 

      if (is_array($gesamt[ $liste[$i] ])) { 
         $text = '<a href="#'.$text.'" class="glossar">'.$text.'</a>'; 
      } 

      echo $text.'&nbsp;'; 
   } 
*/
   echo '</td></tr> 
            <tr><td colspan="3" align="left" class="text">Dieses Glossar enth&auml;lt '.$anzahl_artikel.' Artikel.</td></tr> 
'; 

   foreach ($liste as $buchstabe) { 
      if (is_array($gesamt[$buchstabe])) { 
         sort($gesamt[$buchstabe]); 

         $text = strtoupper($buchstabe); 

         echo '            <tr><td colspan="3" width="'.$textspalteplus.'"><img src="images/dotclear.gif" width="'.$textspalteplus.'" height="10" alt=""></td></tr> 
            <tr> 
               <td valign="top" width="'.$breiterand.'">&nbsp;</td> 
               <td valign="top" width="'.$breitekomplett.'" valign="top" class="glossar_liste"><a name="'.$text.'"></a>'.$text.'</td> 
               <td valign="top" width="'.$breiterand.'">&nbsp;</td> 
            </tr> 
'; 

         foreach ($gesamt[$buchstabe] as $eintrag) { 
            $link = $sess->url("front_content.php?idcat=".$eintrag['kategorie']."&idart=".$eintrag['artikel'].$sessionid); 

            echo '            <tr> 
               <td valign="top" width="'.$breiterand.'">&nbsp;</td> 
               <!--<td valign="top" width="'.$breitekomplett.'" valign="top" class="glossar_liste"><a href="'.$link.'" class="glossar_headlinelink">'.$eintrag['titel'].'</a> ('.$eintrag['abteilung'].')</td> -->
               <td valign="top" width="'.$breitekomplett.'" valign="top" class="glossar_liste"><a href="'.$link.'" class="glossar_headlinelink">'.$eintrag['titel'].'</a></td> 
               <td valign="top" width="'.$breiterand.'">&nbsp;</td> 
            </tr> 
'; 
         }
/* Abstand verkleinern
      echo '            <tr> 
               <td valign="top" width="'.$breiterand.'">&nbsp;</td> 
               <td valign="top" width="'.$breitekomplett.'">&nbsp;</td> 
               <td valign="top" width="'.$breiterand.'">&nbsp;</td> 
            </tr> 
'; 
*/
      } 
   } 

} else { 
   echo '            <tr> 
               <td valign="top" width="">&nbsp;</td> 
               <td valign="top" align="left" width="">Dieses Glossar enth&auml;lt leider noch keine Artikel.</td> 
               <td valign="top" width="">&nbsp;</td> 
            </tr> 
            <tr> 
               <td valign="top" width="">&nbsp;</td> 
               <td valign="top" width="">&nbsp;</td> 
               <td valign="top" width="">&nbsp;</td> 
            </tr> 
'; 
} 

unset ($breiterand); 
unset ($breitekomplett); 
echo "</table>\n";
?>

Verfasst: Mi 10. Jan 2007, 14:24
von Marxer
Ich habe das Modul etwas abgeändert. In Zeile 105 wurde die Variable $parentcatid für die Anker-Links nicht automatisch abgefragt, was dann zu Fehlern führte wenn die Links in der Kopfzeile angeklickt werden.

Bei mir läuft das Modul jetzt unter 4.6.15 problemlos. :D

Hier der Code:

Code: Alles auswählen

<?php 

$parentcatid = 36; 
$cmstypeid = 1; 
$numberofcmstype = 1; 

echo "<!-- Modul: Glossarliste -->\n"; 
echo "<table ...>\n"; 

function klein($text) { 
   $text = urldecode($text); 

   $text = strip_tags($text, ""); 

//   $text = str_replace(" ", "_", $text); 
   $text = str_replace(":", "_", $text); 
   $text = str_replace("(", "_", $text); 
   $text = str_replace(")", "_", $text); 
   $text = str_replace("[", "_", $text); 
   $text = str_replace("]", "_", $text); 
   $text = str_replace("'", "_", $text); 
   $text = str_replace('"', '_', $text); 

   $text = strtolower($text); 

   $text = str_replace("ä", "ae", $text); 
   $text = str_replace("ö", "oe", $text); 
   $text = str_replace("ü", "ue", $text); 
   $text = str_replace("ß", "ss", $text); 

   return $text; 
} 

function unterkategorien($kategorie) { 
   global $cfg, $unterkat; 
   $unterkat[] = $kategorie; 

   $db = new DB_Contenido; 
   $sql = "SELECT idcat FROM {$cfg['tab']['cat']} WHERE parentid = '".$kategorie."' ORDER BY idcat ASC;"; 
   $db->query($sql); 

   while ($db->next_record()) { 
      unterkategorien($db->f("idcat")); 
   } 
} 

$db = new DB_Contenido; 
$db2 = new DB_Contenido; 

$breiterand = 5; 
$breitekomplett = 200 - 2 * $breiterand; 

$liste = array("0-9", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "@"); 

foreach ($liste as $buchstabe) { 
   $gesamt[$buchstabe] = ""; 
} 

$unterkat = array(); 
unterkategorien($parentcatid); 

// liest die anzahl betroffener artikel aus der datenbank 
$sql = "SELECT count(*) AS anzahl FROM ".$cfg['tab']['cat']." AS a LEFT JOIN ".$cfg['tab']['cat_art']." AS b ON a.idcat = b.idcat LEFT JOIN ".$cfg['tab']['art_lang']." AS c ON b.idart = c.idart LEFT JOIN ".$cfg['tab']['content']." AS d ON c.idartlang = d.idartlang LEFT JOIN ".$cfg['tab']['cat_lang']." AS e ON a.idcat = e.idcat WHERE a.parentid IN (".implode(", ", $unterkat).") AND d.idtype = '".$cmstypeid."' AND d.typeid = '".$numberofcmstype."' AND d.value != '';"; 
$db->query($sql); 
$db->next_record(); 
$anzahl_artikel = $db->f("anzahl"); 

if ($anzahl_artikel > 0) { 
   $sql = "SELECT d.value, b.idart, b.idcat, e.name FROM ".$cfg['tab']['cat']." AS a LEFT JOIN ".$cfg['tab']['cat_art']." AS b ON a.idcat = b.idcat LEFT JOIN ".$cfg['tab']['art_lang']." AS c ON b.idart = c.idart LEFT JOIN ".$cfg['tab']['content']." AS d ON c.idartlang = d.idartlang LEFT JOIN ".$cfg['tab']['cat_lang']." AS e ON a.idcat = e.idcat WHERE a.parentid IN (".implode(", ", $unterkat).") AND d.idtype = '".$cmstypeid."' AND d.typeid = '".$numberofcmstype."' AND d.value != '';"; 
   $db->query($sql); 

   while ($db->next_record()) { 
      $suche = klein($db->f("value")); 
      $suchindex = substr($suche, 0, 1); 
      $titel = urldecode($db->f("value")); 
      $artikel = $db->f("idart"); 
      $kategorie = $db->f("idcat"); 
      $abteilung = $db->f("name"); 

      $gefunden = false; 

      foreach ($liste as $value) { 
         $wert = ord($suchindex); 
         if (($wert > 47) && ($wert < 57)) 
            $suchindex = "0-9"; 

         if ($value == $suchindex) { 
            $gefunden = true; 
            break; 
         } 
      } 

      if ($gefunden) { 
         $gesamt[$suchindex][] = array('suche' => $suche, 'titel' => $titel, 'kategorie' => $kategorie, 'artikel' => $artikel, 'abteilung' => $abteilung); 
      } else { 
         $gesamt['@'][] = array('suche' => $suche, 'titel' => $titel, 'kategorie' => $kategorie, 'artikel' => $artikel, 'abteilung' => $abteilung); 
      } 
   } 

   echo '            <tr><td align="left" colspan="3" class="glossar"><br>'; 
   for ($i = 0; $i < 28; $i++) { 
      $text = strtoupper($liste[$i]); 

      if (is_array($gesamt[ $liste[$i] ])) { 
         $text = '<a href="front_content.php?idcat='.$parentcatid.'#'.$text.'" class="glossar">'.$text.'</a>'; 
      } 

      echo $text.'&nbsp;&nbsp;'; 
   } 
  
/*   echo '</td></tr> 
            <tr><td align="left" colspan="3" class="glossar">'; 
   for ($i = 14; $i < 28; $i++) { 
      $text = strtoupper($liste[$i]); 

      if (is_array($gesamt[ $liste[$i] ])) { 
         $text = '<a href="#'.$text.'" class="glossar">'.$text.'</a>'; 
      } 

      echo $text.'&nbsp;'; 
   } 
*/ 
   echo '</td></tr> 
            <tr><td colspan="3" align="left" class="text">Dieses Glossar enth&auml;lt '.$anzahl_artikel.' Artikel.</td></tr> 
'; 

   foreach ($liste as $buchstabe) { 
      if (is_array($gesamt[$buchstabe])) { 
         sort($gesamt[$buchstabe]); 

         $text = strtoupper($buchstabe); 

         echo '            <tr><td colspan="3" width="'.$textspalteplus.'"><img src="images/dotclear.gif" width="'.$textspalteplus.'" height="10" alt=""></td></tr> 
            <tr> 
               <td valign="top" width="'.$breiterand.'">&nbsp;</td> 
               <td valign="top" width="'.$breitekomplett.'" valign="top" class="glossar_liste"><a name="'.$text.'"></a>'.$text.'</td> 
               <td valign="top" width="'.$breiterand.'">&nbsp;</td> 
            </tr> 
'; 

         foreach ($gesamt[$buchstabe] as $eintrag) { 
            $link = $sess->url("front_content.php?idcat=".$eintrag['kategorie']."&idart=".$eintrag['artikel'].$sessionid); 

            echo '            <tr> 
               <td valign="top" width="'.$breiterand.'">&nbsp;</td> 
               <!--<td valign="top" width="'.$breitekomplett.'" valign="top" class="glossar_liste"><a href="'.$link.'" class="glossar_headlinelink">'.$eintrag['titel'].'</a> ('.$eintrag['abteilung'].')</td> --> 
               <td valign="top" width="'.$breitekomplett.'" valign="top" class="glossar_liste"><a href="'.$link.'" class="glossar_headlinelink">'.$eintrag['titel'].'</a></td> 
               <td valign="top" width="'.$breiterand.'">&nbsp;</td> 
            </tr> 
'; 
         } 
/* Abstand verkleinern 
      echo '            <tr> 
               <td valign="top" width="'.$breiterand.'">&nbsp;</td> 
               <td valign="top" width="'.$breitekomplett.'">&nbsp;</td> 
               <td valign="top" width="'.$breiterand.'">&nbsp;</td> 
            </tr> 
'; 
*/ 
      } 
   } 

} else { 
   echo '            <tr> 
               <td valign="top" width="">&nbsp;</td> 
               <td valign="top" align="left" width="">Dieses Glossar enth&auml;lt leider noch keine Artikel.</td> 
               <td valign="top" width="">&nbsp;</td> 
            </tr> 
            <tr> 
               <td valign="top" width="">&nbsp;</td> 
               <td valign="top" width="">&nbsp;</td> 
               <td valign="top" width="">&nbsp;</td> 
            </tr> 
'; 
} 

unset ($breiterand); 
unset ($breitekomplett); 
echo "</table>\n"; 
?> 
Natürlich sind die Variablen am Anfang dementsprechend zu ändern. :roll:

Verfasst: Mi 17. Jan 2007, 10:31
von Cym
Ich habe mal den Code von Marxer etwas geändert.

Die Ausgabe erfolgt nun nichtmehr über eine Tabelle. Das Layout wird nun mit CSS bestimmt.

Code:

Code: Alles auswählen

<?php

$parentcatid = 1;
$cmstypeid = 1;
$numberofcmstype = 1;

echo "<!-- Modul: Glossarliste -->\n";
echo "<div id='glossar'>";

function klein($text) {
   $text = urldecode($text);

   $text = strip_tags($text, "");

   $text = str_replace(":", "_", $text);
   $text = str_replace("(", "_", $text);
   $text = str_replace(")", "_", $text);
   $text = str_replace("[", "_", $text);
   $text = str_replace("]", "_", $text);
   $text = str_replace("'", "_", $text);
   $text = str_replace('"', '_', $text);

   $text = strtolower($text);

   $text = str_replace("ä", "ae", $text);
   $text = str_replace("ö", "oe", $text);
   $text = str_replace("ü", "ue", $text);
   $text = str_replace("ß", "ss", $text);

   return $text;
}

function unterkategorien($kategorie) {
   global $cfg, $unterkat;
   $unterkat[] = $kategorie;

   $db = new DB_Contenido;
   $sql = "SELECT idcat FROM {$cfg['tab']['cat']} WHERE parentid = '".$kategorie."' ORDER BY idcat ASC;";
   $db->query($sql);

   while ($db->next_record()) {
      unterkategorien($db->f("idcat"));
   }
}

$db = new DB_Contenido;
$db2 = new DB_Contenido;

$breiterand = 5;
$breitekomplett = 200 - 2 * $breiterand;

$liste = array("0-9", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "@");

foreach ($liste as $buchstabe) {
   $gesamt[$buchstabe] = "";
}

$unterkat = array();
unterkategorien($parentcatid);

// liest die anzahl betroffener artikel aus der datenbank
$sql = "SELECT count(*) AS anzahl FROM ".$cfg['tab']['cat']." AS a LEFT JOIN ".$cfg['tab']['cat_art']." AS b ON a.idcat = b.idcat LEFT JOIN ".$cfg['tab']['art_lang']." AS c ON b.idart = c.idart LEFT JOIN ".$cfg['tab']['content']." AS d ON c.idartlang = d.idartlang LEFT JOIN ".$cfg['tab']['cat_lang']." AS e ON a.idcat = e.idcat WHERE a.parentid IN (".implode(", ", $unterkat).") AND d.idtype = '".$cmstypeid."' AND d.typeid = '".$numberofcmstype."' AND d.value != '';";
$db->query($sql);
$db->next_record();
$anzahl_artikel = $db->f("anzahl");

if ($anzahl_artikel > 0) {
   $sql = "SELECT d.value, b.idart, b.idcat, e.name FROM ".$cfg['tab']['cat']." AS a LEFT JOIN ".$cfg['tab']['cat_art']." AS b ON a.idcat = b.idcat LEFT JOIN ".$cfg['tab']['art_lang']." AS c ON b.idart = c.idart LEFT JOIN ".$cfg['tab']['content']." AS d ON c.idartlang = d.idartlang LEFT JOIN ".$cfg['tab']['cat_lang']." AS e ON a.idcat = e.idcat WHERE a.parentid IN (".implode(", ", $unterkat).") AND d.idtype = '".$cmstypeid."' AND d.typeid = '".$numberofcmstype."' AND d.value != '';";
   $db->query($sql);

   while ($db->next_record()) {
      $suche = klein($db->f("value"));
      $suchindex = substr($suche, 0, 1);
      $titel = urldecode($db->f("value"));
      $artikel = $db->f("idart");
      $kategorie = $db->f("idcat");
      $abteilung = $db->f("name");

      $gefunden = false;

      foreach ($liste as $value) {
         $wert = ord($suchindex);
         if (($wert > 47) && ($wert < 57))
            $suchindex = "0-9";

         if ($value == $suchindex) {
            $gefunden = true;
            break;
         }
      }

      if ($gefunden) {
         $gesamt[$suchindex][] = array('suche' => $suche, 'titel' => $titel, 'kategorie' => $kategorie, 'artikel' => $artikel, 'abteilung' => $abteilung);
      } else {
         $gesamt['@'][] = array('suche' => $suche, 'titel' => $titel, 'kategorie' => $kategorie, 'artikel' => $artikel, 'abteilung' => $abteilung);
      }
   }
  
   $quickLinks = "";
  
   for ($i = 0; $i < 28; $i++) {
      $text = strtoupper($liste[$i]);

      if (is_array($gesamt[ $liste[$i] ])) {
        $quickLinks .= "<li><a href=\"front_content.php?idcat=".$parentcatid."#".$text."\" class=\"glossar\">".$text."</a></li>";
      } else {
      	$quickLinks .= "<li>".$text."</li>";	
      }
   }
   	echo "<ul id='glossarQuicklinks'>".$quickLinks."</ul>".
   		 "<br /><p>Dieses Glossar enth&auml;lt ".$anzahl_artikel." Artikel</p>";
   		
   		/******
		 *** Einträge
		 ******/
	echo "<ul id='glossarEintraege'>";

   	foreach ($liste as $buchstabe) {
      if (is_array($gesamt[$buchstabe])) {
         sort($gesamt[$buchstabe]);

         $text = strtoupper($buchstabe);
         
         echo "<li id=".$text.">".$text."</li>";
		 
         foreach ($gesamt[$buchstabe] as $eintrag) {
            $link = $sess->url("front_content.php?idcat=".$eintrag['kategorie']."&idart=".$eintrag['artikel'].$sessionid);
			
			echo "<li><a href=".$link." class='glossar_headlinelink'>".$eintrag['titel']."</a></li>";
         }
      }
   }
   echo "</div>"; // close div glossarEinträge

} else {
	echo "<div id=\"glossarEintraege\">Dieses Glossar enth&auml;lt leider noch keine Artikel.</div>";
}

unset ($breiterand);
unset ($breitekomplett);
echo "</div>";
?> 
CSS

Code: Alles auswählen

/* Glossar */
#glossar {
}

#glossarQuicklinks  {
	list-style: none;
}

#glossarQuicklinks li {
	float: left;	
	margin-right: 10px;
}

#glossarEintraege {
	list-style: none;
}

Modul: Glossarliste

Verfasst: Mi 30. Mai 2007, 23:32
von YAY
Hallo,

kann mir jemand beschreiben was ich da ganz genau machen muss damit ich diesen Glossar zum laufen bringe?

Folgendes habe ich bisher verstanden und umgesetzt:
  • den Code von "Cym" als neues Module in die Ausgabe. Dann ein Template erstellen "glossar".
  • Im Content Kategorie ein Verzeichniss anlegen z. B. "Glossar", dort das Template auswählen "glossar".
  • Dann Hauptverzeichnisse z. B. "Kategorie 1", "Kategorie 2" ...
  • Dann Artikel anlegen, die sich in der Jeweiligen Kategorien befinden. z. B. in Kategorie1 "Artikel 1", in Kategorie2 "Artikel 2"
welches Template müssen diese Artikel und Kategorien Haben? Muss da auch das Template Glossar eingestellt werden oder keins?
Muss ich da sonst noch etwas beachten? habe ich da etwas vergessen?
Welche nummern muss ich bei $parentcatid = ???; $cmstypeid = ???; $numberofcmstype = ???; Ich habe dort überall eine 1 stehen.

Momentan erscheint bei mir die Liste zwar aber mit der Kompletten Hauptnavigation und @ zeichen, es werden die Strukturen von der Hauptnavigation aufgelistet aber die Kategorien die ich im Verzeichniss glossar angelegt habe nicht.

Kann mir da jemand helfen.

Ein Danke schonmal im voraus.



[/list]