da nun unser contenido Projekt fast abgeschlossen ist will ich hier mal ein paar Module posten, die wir geschrieben bzw. modifiziert haben. Zuerst einmal die allseits bekannte Artikelliste, die wir um eine Thumbnailgenerierung erweitert haben. Vorrausetzung für die Thumbnails ist, dass die aufgelisteten Artikel mit dem Modul "DER ARTIKEL" erstellt werden. Folgende Erweiterungen sind also Vorrausetzung für dieses Modul:
1. DER ARTIKEL und mip_forms
2. Seitensortierung http://contenido.de/forum/viewtopic.php?t=308
Und hier eine kleine Featurelist:
1. Thumbnailserstellung (es wird automatisch das neueste Bild generiert, Voraussetzung ist natürlich GD, die Thumbnails werden im img Verzeichnis des Frontends mit dem Präfix "thumb_" vor dem Originaldateinamen gespeichert)
2. Artikelsortierung nach letzter Änderung, alphabetisch nach Titel oder nach der contenido Seitensortierung
3. Eingabedatum wahlweise anzeigen
4. Listet alle Seiten eines Bereiches ohne Startartikel auf
Leider kann ich nicht 100%ig für die Funktionstüchtigkeit garantieren, da wir das contenido für unsere Bedürfnisse etwas zurechtgebogen haben. Ich habe dieses Modul soweit es geht dahingehend angepaßt, dass es mit den erwähnten Erweiterungen laufen müßte.
Und hier der Code:
Code: Alles auswählen
?><?/***********************************************
* CONTENIDO MODUL - INPUT
*
* Modulname : Artikelliste
* Author(s) : 4fb - Jan Lengowski, Jose Rodriguez
* Copyright : Contenido - four for business, Jose Rodriguez
* Created : 15-08-2002
* Modified : 21-09-2002
* Modified by : D. Wagner 01-11-2002
* Modified : 11-05-2003
* Modified by : medialis marketing GmbH - Hanta Seewald
************************************************/
// selected category
$selected = "CMS_VALUE[0]";
echo "<table cellspacing=\"0\" cellpadding=\"10\" border=\"0\">
<tr valign=\"top\">
<td>News-Verzeichnis:</td>
<td>
<select name=\"CMS_VAR[0]\">";
// fetch all categorys
$query = "SELECT A.idcat, A.level, C.name FROM $cfgTab_cat_tree AS A, ".
"$cfgTab_cat AS B, $cfgTab_cat_lang AS C WHERE A.idcat=B.idcat ".
"AND B.idcat=C.idcat AND C.idlang='$lang' AND B.idclient='$client' ".
"AND C.visible=1 ORDER BY A.idtree desc";
// execute query
$db->query($query);
// loop result and build the options
while ($db->next_record()) {
// indent spacer
$spaces = "";
// how many levels
$levels = $db->f("level");
for ($i = 0; $i > $levels; $i ++) {
// add 2 spaces for every level
$spaces = $spaces . "-";
} // end for
if ($selected == $db->f("idcat")) {
// selected category
echo "<option selected=\"selected\" value=\"". $db->f("idcat") ."\">". $spaces . $db->f("name") ."</option>";
} else {
// category
echo "<option value=\"". $db->f("idcat") ."\">". $spaces . $db->f("name") ."</option>";
} // end if
} // end while
echo " </select>
</td>
</tr>";
?>
<tr>
<td>Ordnen nach:</td>
<td colspan="3"><input type="Radio" name="CMS_VAR[2]" value="sort"<? if ("CMS_VALUE[2]" == "sort" || "CMS_VALUE[2]" == "") echo " checked" ?>> Standard<br>
<input type="Radio" name="CMS_VAR[2]" value="title"<? if ("CMS_VALUE[2]" == "title") echo " checked" ?>> Titel<br>
<input type="Radio" name="CMS_VAR[2]" value="idside"<? if ("CMS_VALUE[2]" == "idside") echo " checked" ?>> Datum<br>
</td>
</tr>
<tr>
<td>Eingabedatum anzeigen:</td>
<td colspan="3"><input type="Checkbox" name="CMS_VAR[5]" value="Ja"<? if ("CMS_VALUE[5]" == "Ja") echo " checked" ?>></td>
</tr>
<?
echo "<tr>
<td>Anzahl Artikel:</td>";
if("CMS_VALUE[1]"!=0){
echo"<td><input type=\"text\" name=\"CMS_VAR[1]\" value=\"CMS_VALUE[1]\"></td>";
}
else{
echo"<td><input type=\"text\" name=\"CMS_VAR[1]\" value=\"3\"></td>";
}
echo"
</tr>
<tr>
<td>Untertitel (Anzahl Zeichen)</td>";
if("CMS_VALUE[3]"!=0){
echo"<td><input type=\"text\" name=\"CMS_VAR[3]\" value=\"CMS_VALUE[3]\"></td>";
}
else{
echo"<td><input type=\"text\" name=\"CMS_VAR[3]\" value=\"50\"></td>";
}
echo"
</tr>";
?>
<tr>
<td valign="top"><input type="checkbox" name="CMS_VAR[6]" value="ja"<? if ("CMS_VALUE[6]" == "ja") echo " checked" ?>> Thumbnail:</td>
<td colspan="3"> </td>
</tr>
<?
echo "</table>";
Code: Alles auswählen
?><?/***********************************************
* CONTENIDO MODUL - OUTPUT
*
* Modulname : Artikelliste
* Author(s) : 4fb - Jan Lengowski, Jose Rodriguez
* Copyright : Contenido - four for business, Jose Rodriguez
* Created : 15-08-2002
* Modified : 21-09-2002
* Modified by : D. Wagner 01-11-2002
* Modified : 11-05-2003
* Modified by : medialis marketing GmbH - Hanta Seewald
************************************************/
// selected category
$selcat = "CMS_VALUE[0]";
// anzahl articles
$showart= "CMS_VALUE[1]";
// anzahl der zeichen h1
$mxh = "CMS_VALUE[3]";
//Konfiguration Thumbnailgenerierung
$breite_neu = 80;//breite auf die die Bildern verkleinert werden
$praefix_thumb = "thumb_";//wird vor dem urspruenglichen Dateinamen eingefuegt
//Ordnen nach
if ("CMS_VALUE[2]" == "" || "CMS_VALUE[2]" == "sort") {//Ordnen nach der Reihenfolge wie sie in der Seitenansicht von contenido ist
$order_by = "CATART.sort DESC";
}else if ("CMS_VALUE[2]" == "title") {//alphabetisch nach Titel
$order_by = "ARTLANG.CMS_VALUE[2] ASC";
}else{//idside
$order_by = "ARTLANG.lastmodified DESC";//nach lastmodified ordnen
}
// select all articles in category widthout start article
$query = "SELECT ARTLANG.idside, ARTLANG.idsidelang FROM $cfgTab_cat_side AS CATART, $cfgTab_side_lang AS ARTLANG ".
"WHERE CATART.idcat = '$selcat' AND ARTLANG.idside = CATART.idside AND ARTLANG.idlang = '$lang' AND ".
"ARTLANG.online = '1' ORDER BY ".$order_by;
// execute query
$db->query($query);
unset($articleID);
unset($linkID);
// any news?
$newscounter = ($db->num_rows($db));
if ($newscounter > 0){
// session register des Startwertes für den Wiederbesuch der Seite
// $startwert_news[$client] als Array,
// um dieses Tool bei mehreren clients
// innerhalb einer Site nutzen zu können
$sess->register("startwert_news");
//wenn per link ($startwert_url) ein Startwert kommt
if(isset($startwert_url))
$startwert_news[$client]=$startwert_url;
//wenn weniger Artikel da sind, als gezeigt werden sollen
if ($startwert_news[$client]<$showart)
$startwert_news[$client]=0;
// start html-output
//wenn die Weiterschaltung benötigt wird
if($newscounter>$showart){
$link = $PHP_SELF."?client=$client&lang=$lang&idcat=$idcat&idside=$idside";
?>
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr><td align = "left" width="50%" id="font6">
<?
if($startwert_news[$client]>0){
$summe=$startwert_news[$client] - $showart;
if ($startwert_news[$client]<$showart)
$summe=0;
echo "<a href=\"".$link."&startwert_url=".$summe."\"><img src=\"imgserver/buttons/neuere.gif\" border=\"0\"></a>";
}
?>
</td>
<td align ="right" width="50%" id="font6">
<?
if($startwert_news[$client]<$newscounter-$showart){
$summe=$startwert_news[$client]+$showart;
echo "<a href=\"$link&startwert_url=".$summe."\"><img src=\"imgserver/buttons/aeltere.gif\" border=\"0\"></a>";
}
?>
</td></tr>
</table><br><br>
<?
}
//Ausgabe der Variablen
/*
echo"
<tr><td class=\"\" colspan=\"2\">
counter: ".$newscounter."<br>
limit: ".$showart."<br>
startwert_news: ".$startwert_news[$client]
."</td></tr>";
*/
// get id's of sub articles
while ($db->next_record()) {
$articleID[] = $db->f("idsidelang");
$linkID[] = $db->f("idside");
} // end while
// loop through subarticles
if($newscounter >= $showart+$startwert_news[$client])$i_max=$showart+$startwert_news[$client];
if($newscounter < $showart+$startwert_news[$client])$i_max=$newscounter;
for ($i=$startwert_news[$client]; $i<$i_max;$i++){
// select all CMS variables of the article
//Thumbnailgenerierung
if ("CMS_VALUE[6]" == "ja") {
//Contenido Uploadbilder für Thumbnail verwenden
$query = "SELECT * FROM $cfgTab_content WHERE idsidelang = '".$articleID[$i]."' AND idtype=4 ORDER BY typeid desc LIMIT 1";
$db -> query($query);
$db->next_record();
$img_id = $db->f("value");
//wenn Bild vorhanden
if ($img_id) {
$query = "SELECT filename,dirname FROM $cfgTab_upl WHERE idupl='".$img_id."' LIMIT 1";
$db-> query($query);
$db-> next_record();
$img_filename = $db->f("filename");
$img_dirname = $db->f("dirname");
$thumb_verzhandle = $cfgClient[2]["htmlpath"]["frontend"].$img_dirname;
if (file_exists($thumb_verzhandle."/".$praefix_thumb.$img_filename)) {
$orig_time = filemtime($thumb_verzhandle."/".$img_filename);
$thumb_time = filemtime($thumb_verzhandle."/".$praefix_thumb.$img_filename);
} else{
$orig_time = 1;
$thumb_time = 0;
}
//Wenn Originaldatei groesser als Thumbnail ist erneuere es
if ($orig_time > $thumb_time) {
$quellbild = ImageCreateFromJPEG($thumb_verzhandle."/".$img_filename);
$breite = ImageSX($quellbild);
$hoehe = ImageSY($quellbild);
$skalierungsfaktor = $breite/$breite_neu;
$hoehe_neu = $hoehe/$skalierungsfaktor;
$zielbild = ImageCreate($breite_neu, $hoehe_neu);
ImageCopyResized($zielbild, $quellbild, 0, 0, 0, 0, $breite_neu, $hoehe_neu, $breite, $hoehe);
$verz_handle = $cfgClient[2]["htmlpath"]["frontend"].$img_dirname."/".$praefix_thumb.$img_filename;
ImageJPEG($zielbild, $verz_handle, 65);
}
}
}
if ($con_side["CMS_VALUE[0]"][$linkID[$i]][is_start] == "0") {
$query = "SELECT title,summary, created, lastmodified FROM $cfgTab_side_lang WHERE idsidelang = '$articleID[$i]'";
// execute query
$db->query($query);
// link
$link = $sess->url("front_content.php?client=$client&lang=$lang&idcat=$selcat&idside=$linkID[$i]");
// loop through result and extraxt data
while ($db->next_record()) {
// data type
$headline[] = $db->f("title");
$created= date("d.m.y",strtotime($db->f("created")));
$lastmodified= date("d.m.y",strtotime($db->f("lastmodified")));
$summary = $db->f("summary");
$len = strlen($summary);
// cut summary if too long
if ($len > $mxh ) {
$summary = substr($summary,0,$mxh);
$summary = $summary . " ...";
} // end if
} // end while
// HTML template for one element
?>
<table width="435" border="0" cellpadding="0" cellspacing="4" align="center">
<tr>
<?
$colspan="2";
if ($verz_handle) {
$breite = 80;
$bildgroesse = getimagesize($verz_handle);
$skalierungsfaktor = $bildgroesse[0]/$breite;
$hoehe_neu = $bildgroesse[1]/$skalierungsfaktor;
$bildgroesse[0] = $breite; //breite
$bildgroesse[1] = $hoehe_neu; //hoehe
$colspan = "3";
?>
<td rowspan="2" width="<? echo $info[0] ?>"><img src="<? echo $verz_handle ?>" border="0" width="<? echo $bildgroesse[0] ?>" height="<? echo $bildgroesse[1] ?>"></td>
<?
}
?>
<td id="font6" valign="top" width="100%"><b><? echo $headline[0] ?></b></td>
<td id="font6" align="right" valign="top"><? if ("CMS_VALUE[5]" == "Ja") echo $lastmodified ?></td>
</tr>
<tr>
<td colspan="2" id="font6" valign="top">
<?
if($summary!="") echo $summary."<br>";
?>
<a href="<? echo $link ?>"><img src="imgserver/buttons/mehr.gif" width="61" height="21" border="0" align="right" alt="gesamte Meldung lesen"></a></td>
</tr>
<tr>
<td colspan="<? echo $colspan ?>" bgcolor="<? echo $beh_color[Seiten] ?>" height="1"><img src="imgserver/mixed/clear.gif" width="1" height="1" border="0" alt=""></td>
</tr>
<tr>
<td colspan="<? echo $colspan ?>"><br></td>
</tr>
</table>
<?
unset($headline);
unset($summary);
unset($created);
unset($verz_handle);
} //ende ist is_start
} // end foreach
} // end any news?
Der Inputbereich enthält einfach eine select-Box mit allen zur Verfügung stehenden Rubriken, auf die weitergeleitet werden kann. Was ich persönlich bequemer finde als die Option "Weiterleitung" in den Seiteneigenschaften.
Und hier der Code:
Code: Alles auswählen
?>
<?
/*************************************************
* CONTENIDO MODUL INPUT
* Modulname : Weiterleitung
* Author : medialis marketing GmbH - Hanta Seewald
* Copyright : medialis marketing GmbH
* Created : 11-05-2003
*************************************************/
?>
<table align="left" cellpadding="0" cellspacing="0" border="0">
<tr>
<td>Weiterleitung auf folgende Rubrik:</td>
<td>
<select name="<? echo "CMS_VAR[0]" ?>">";
<?
// fetch all categorys
$query = "SELECT A.idcat, A.level, C.name FROM $cfgTab_cat_tree AS A, ".
"$cfgTab_cat AS B, $cfgTab_cat_lang AS C WHERE A.idcat=B.idcat ".
"AND B.idcat=C.idcat AND C.idlang='$lang' AND B.idclient='$client' ".
"AND C.visible=1 ORDER BY A.idtree desc";
// execute query
$db->query($query);
// loop result and build the options
while ($db->next_record()) {
if ("CMS_VALUE[0]" == $db->f("idcat")) {
// selected category
echo "<option selected=\"selected\" value=\"". $db->f("idcat") ."\">". $spaces . $db->f("name") ."</option>";
} else {
// category
echo "<option value=\"". $db->f("idcat") ."\">". $spaces . $db->f("name") ."</option>";
} // end if
} // end while
echo " </select>"
?>
</td>
</tr>
</table>
Code: Alles auswählen
?><?
/*************************************************
* CONTENIDO MODUL OUTPUT
* Modulname : Weiterleitung
* Author : medialis marketing GmbH - Hanta Seewald
* Copyright : medialis marketing GmbH
* Created : 11-05-2003
*************************************************/
if ("CMS_VALUE[0]") {
header ("Location:".$con_tree["CMS_VALUE[0]"][link]."");
}
Gruß
makemyday