Aktualisierte Version 0.4:
Code: Alles auswählen
alle kategorien unterhalb der konfigurierten, koennen nacheinander absteigend durchlaufen werden.
dazu werden ein select-feld {SELECT}, zur auswahl der naechsten kategorie, und links {LINK} zu den vorher ausgewaehlten kategorien mittels template dargestellt.
artikel die innerhalb der zuletzt ausgewaehlten kategorie existieren, werden mittels template als artikelliste dargestellt.
moeglichkeiten
-----------------------------------------------
kategorie
-----------------------------------------------
- kategorie auswaehlen
- sortierung nach
- sortierungsrichtung
- angabe fuer name des templatefile fuer menue
- angabe des trennzeichens zw. den links
-----------------------------------------------
artikel
-----------------------------------------------
- sortierung nach
- sortierungsrichtung
- limit artikel pro seite
- limit anzeige artikle insgesamt
- limit zeichen fuer artikelinhalt in artikelliste
- startikel einbinden ja/nein
- ueberschrift fuer artikeliste
- formatierungsmoeglichkeit fuer option 'sortierung nach' zur anzeige in artikelliste(nur datum)
- 1. bild des artikels anzeigen
- groesse das bildes anpassen
- angabe fuer name des templatefile
- angabe fuer name des templatefile bei nicht vorhandensein von artikeln
template-vars
-----------------------------------------------
{SELECT} - auswahlliste mit den naechsten unterkategorien
{LINK} - linkliste mit den schaon ausgewaehlten kategorien
{TITLE} - Vorgabe fuer Headlinie der Artikelliste aus der Konfiguration
{SORTVALUE} - Ausgabe der Sortierungvorgabe(Sinnvoll fuer News, da so Newsdatum angezeigt werden kann)
{HEADLINE} - Ueberschrift des Artikels OHNE html-tags
{TEXT} - Inhalt des Artikels OHNE html-tags und begrenzt auf konfigurierte Anzahl von Zeichen
{IMG} - 1. Bild des Artikels
{PAGE} - Links zu den Seiten der Artikeliste, bei mehr Artikel als des konfigurierte Limit
Code: Alles auswählen
?><?php
/***********************************************
* CONTENIDO MODUL - INPUT
*
* Modulname: SubCategory Browser (SCB)
* Author(s): Rene Hankel
* Copyright: michse
* Created: 2006.03.30
* Version: 0.4
*
************************************************/
//----------------------------------------------------------------
// selected category
unset($lo_set);
$lo_set = array();
// kategorie
$lo_set["Cat_Id"] = "CMS_VALUE[0]";
$lo_set["Cat_SortBy"] = "CMS_VALUE[1]";
$lo_set["Cat_SortDir"] = "CMS_VALUE[2]";
$lo_set["Cat_TplMenu"] = "CMS_VALUE[3]";
$lo_set["Cat_Separator"] = "CMS_VALUE[17]";
// artikel
$lo_set["Art_SortBy"] = "CMS_VALUE[4]";
$lo_set["Art_SortDir"] = "CMS_VALUE[5]";
$lo_set["Art_Limit"] = "CMS_VALUE[6]";
$lo_set["Art_MaxArt"] = "CMS_VALUE[7]";
$lo_set["Art_MaxChar"] = "CMS_VALUE[8]";
$lo_set["Art_IncStart"] = "CMS_VALUE[9]";
$lo_set["Art_Headline"] = "CMS_VALUE[10]";
$lo_set["Art_SortValueFormat"] = "CMS_VALUE[11]";
$lo_set["Art_ShowImg"] = "CMS_VALUE[12]";
$lo_set["Art_ImgWidth"] = "CMS_VALUE[13]";
$lo_set["Art_ImgHeight"] = "CMS_VALUE[14]";
$lo_set["Art_Tpl"] = "CMS_VALUE[15]";
$lo_set["Art_TplNo"] = "CMS_VALUE[16]";
$lo_set["Art_Filter"] = "CMS_VALUE[18]";
//----------------------------------------------------------------
// default vars
// kategorie
$lo_default_cat_sortby = 'C.name';
$lo_default_cat_sortdir = 'desc';
$lo_default_cat_tplmenu = 'scb_catmenu.html';
$lo_default_cat_separator = ' → ';
// artikel
$lo_default_art_sortby = 'created';
$lo_default_art_sortdir = 'desc';
$lo_default_art_tpl = 'scb_art.html';
$lo_default_art_tplno = 'scb_artno.html';
$lo_default_art_limit = 5;
$lo_default_art_maxart = 50;
$lo_default_art_maxchar = 200;
$lo_default_art_imgwidth = 200;
$lo_default_art_imgheight = 200;
$lo_default_art_sortvalue = '%Y.%m.%d';
$lo_art_filter_seperator = '<~>';
//----------------------------------------------------------------
// Base settings
// cat - sortby
if(
($lo_set["Cat_SortBy"] != 'C.name') &&
($lo_set["Cat_SortBy"] != 'C.created') &&
($lo_set["Cat_SortBy"] != 'C.lastmodified')
)
{ $lo_set["Cat_SortBy"] = $lo_default_cat_sortby; }
// cat - sortdir
if( ($lo_set["Cat_SortDir"] != 'desc') && ($lo_set["Cat_SortDir"] != 'asc') )
{ $lo_set["Cat_SortDir"] = $lo_default_cat_sortdir; }
// cat - tpl
if( strlen($lo_set["Cat_TplMenu"]) == 0 )
{ $lo_set["Cat_TplMenu"] = $lo_default_cat_tplmenu; }
// cat - tpl
if( strlen($lo_set["Cat_Separator"]) == 0 )
{ $lo_set["Cat_Separator"] = $lo_default_cat_separator; }
//--------------------------
// art - sortby
if(
($lo_set["Art_SortBy"] != 'created') &&
($lo_set["Art_SortBy"] != 'lastmodified') &&
($lo_set["Art_SortBy"] != 'published') &&
($lo_set["Art_SortBy"] != 'artsort') &&
($lo_set["Art_SortBy"] != 'title')
)
{ $lo_set["Art_SortBy"] = $lo_default_art_sortby; }
// art - sortdir
if( ($lo_set["Art_SortDir"] != 'desc') && ($lo_set["Art_SortDir"] != 'asc') )
{ $lo_set["Art_SortDir"] = $lo_default_art_sortdir; }
// art - template
if( strlen($lo_set["Art_Tpl"]) == 0 )
{ $lo_set["Art_Tpl"] = $lo_default_art_tpl; }
// art - template no art
if( strlen($lo_set["Art_TplNo"]) == 0 )
{ $lo_set["Art_TplNo"] = $lo_default_art_tplno; }
// art - limit
if( (int)$lo_set["Art_Limit"] <= 0 )
{ $lo_set["Art_Limit"] = $lo_default_art_limit; }
// art - max art
if( (int)$lo_set["Art_MaxArt"] <= 0 )
{ $lo_set["Art_MaxArt"] = $lo_default_art_maxart; }
// art - maxchar
if( (int)$lo_set["Art_MaxChar"] < 0 )
{ $lo_set["Art_MaxChar"] = $lo_default_art_maxchar; }
elseif( strlen($lo_set["Art_MaxChar"]) == 0 )
{ $lo_set["Art_MaxChar"] = 0; }
if( (int)$lo_set["Art_ImgWidth"] <= 0 )
{ $lo_set["Art_ImgWidth"] = $lo_default_art_imgwidth; }
if( (int)$lo_set["Art_ImgHeight"] <= 0 )
{ $lo_set["Art_ImgHeight"] = $lo_default_art_imgheight; }
if( strlen($lo_set["Art_SortValueFormat"]) == 0 )
{ $lo_set["Art_SortValueFormat"] = $lo_default_art_sortvalue; }
// serialisierte var exploden, wenn vorhanden
if( strlen($lo_set["Art_Filter"]) != 0 )
{ $lo_tmparr_cms = (explode($lo_art_filter_seperator, $lo_set["Art_Filter"])); }
else
{ $lo_tmparr_cms = array(); }
//----------------------------------------------------------------
// script zum serialisieren
?>
<script language="JavaScript" type="text/JavaScript">
<!--
function Func_GenerateSerialize(lo_obj)
{
lo_run = 0;
lo_tmp = '';
lo_sep = '<?PHP echo $lo_filter_seperator;?>';
// return multiselect array as string
if ( !lo_obj )
{
return (lo_tmp);
}
for(lo_run = 0; lo_run < lo_obj.length; lo_run++)
{
if ( lo_obj.options[lo_run].selected == true )
{
lo_tmp += (lo_tmp > '' ? lo_sep: '') + lo_obj.options[lo_run].value;
}
}
return (lo_tmp);
}
-->
</script>
<?PHP
//----------------------------------------------------------------
// db-obj erstellen
if ( !is_object($lo_dbobj) )
{ $lo_dbobj = new DB_Contenido; }
//----------------------------------------------------------------
// artikelspezifikationen abfragen
$lo_sql = 'SELECT SPEC.idartspec, SPEC.artspec, SPEC.client, SPEC.lang ';
$lo_sql.= 'FROM '.$cfg['tab']['art_spec'].' AS SPEC ';
$lo_sql.= 'WHERE SPEC.client = \''.$client.'\' ';
$lo_sql.= 'AND SPEC.lang = \''.$lang.'\' ';
$lo_sql.= 'AND SPEC.online = \'1\' ';
$lo_sql.= 'ORDER BY SPEC.idartspec asc';
// abfrage ausfuehren
$lo_dbobj->query($lo_sql);
//----------------------------------------------------------------
//----------------------------------------------------------------
echo '<table cellspacing="0" cellpadding="5" border="0">'."\n";
//----------------------------------------------------------------
// ueberschrift kategorieoptionen
echo '<tr><td colspan="2"><strong>'.mi18n("Categoryoptions").'</strong></td></tr>'."\n";
echo '<tr><td colspan="2"><hr></td></tr>'."\n";
//----------------------------------------------------------------
// cat - id
echo '<tr>'."\n";
echo ' <td class="text_medium" style="padding:5px">'.mi18n("Select category").': </td>'."\n";
echo ' <td class="text_medium" style="padding:5px">';
echo buildCategorySelect("CMS_VAR[0]", $lo_set["Cat_Id"]);
echo ' <input type="image" src="images/submit.gif">';
echo ' </td>'."\n";
echo '</tr>'."\n";
//----------------------------------------------------------------
// trennlinie
echo '<tr><td colspan="2"><hr></td></tr>'."\n";
//----------------------------------------------------------------
// cat - sortby
echo '<tr>'."\n";
echo ' <td class="text_medium" style="padding:5px;">'.mi18n("Sort by").':</td>'."\n";
echo ' <td class="text_medium" style="padding:5px">';
echo ' <select name="CMS_VAR[1]">'."\n";
// name der categorie
if( ($lo_set["Cat_SortBy"] == '') || ($lo_set["Cat_SortBy"] == 'C.name') )
{ echo '<option value="C.name" selected>'.mi18n("Name of category").'</option>'."\n"; }
else
{ echo '<option value="C.name">'.mi18n("Name of category").'</option>'."\n"; }
// letzte aenderung
if( $lo_set["Cat_SortBy"] == 'C.lastmodified' )
{ echo '<option value="C.lastmodified" selected>'.mi18n("Last Modified Date").'</option>'."\n"; }
else
{ echo '<option value="C.lastmodified">'.mi18n("Last Modified Date").'</option>'."\n"; }
// erstellt
if( $lo_set["Cat_SortBy"] == 'C.created' )
{ echo '<option value="C.created" selected>'.mi18n("Add Date").'</option>'."\n"; }
else
{ echo '<option value="C.created">'.mi18n("Add Date").'</option>'."\n"; }
echo ' </select>'."\n";
echo ' </td>'."\n";
echo '</tr>'."\n";
//----------------------------------------------------------------
// cat - sortdir
echo '</tr>'."\n";
echo ' <td class="text_medium" style="padding:5px;">'.mi18n("ascending sorting").':</td>'."\n";
echo ' <td style="padding:5px;">'."\n";
if( strtolower($lo_set["Cat_SortDir"]) == 'desc' )
{ echo '<input type="radio" name="CMS_VAR[2]" value="asc"/>'."\n"; }
else
{ echo '<input type="radio" name="CMS_VAR[2]" value="asc" checked/>'."\n"; }
echo ' </td>'."\n";
echo '</tr>'."\n";
echo '<tr>'."\n";
echo ' <td class="text_medium" style="padding:5px;">'.mi18n("descending sorting").':</td>'."\n";
echo ' <td style="padding:5px;">'."\n";
if( strtolower($lo_set["Cat_SortDir"]) == 'desc' )
{ echo '<input type="radio" name="CMS_VAR[2]" value="desc" checked/>'."\n"; }
else
{ echo '<input type="radio" name="CMS_VAR[2]" value="desc"/>'."\n"; }
echo ' </td>'."\n";
echo '</tr>'."\n";
//----------------------------------------------------------------
// trennlinie
echo '<tr><td colspan="2"><hr></td></tr>'."\n";
//----------------------------------------------------------------
// cat - tpl
echo '<tr>'."\n";
echo ' <td class="text_medium" style="padding:5px;">'.mi18n("Template menu").':</td>'."\n";
echo ' <td style="padding:5px;"><input type="text" name="CMS_VAR[3]" value="'.$lo_set["Cat_TplMenu"].'"></td>'."\n";
echo '</tr>'."\n";
echo '<tr>'."\n";
//----------------------------------------------------------------
// trennlinie
echo '<tr><td colspan="2"><hr></td></tr>'."\n";
//----------------------------------------------------------------
// cat - seperator
echo '<tr>'."\n";
echo ' <td class="text_medium" style="padding:5px;">'.mi18n("Separator between links").':</td>'."\n";
echo ' <td style="padding:5px;"><input type="text" name="CMS_VAR[17]" value="'.$lo_set["Cat_Separator"].'"></td>'."\n";
echo '</tr>'."\n";
echo '<tr>'."\n";
//----------------------------------------------------------------
//----------------------------------------------------------------
// ueberschrift artikeloptionen
echo '<tr><td colspan="2"> </td></tr>'."\n";
echo '<tr><td colspan="2"><strong>'.mi18n("Articeloptions").'</strong></td></tr>'."\n";
echo '<tr><td colspan="2"><hr></td></tr>'."\n";
//----------------------------------------------------------------
// art - sortby
echo '<tr>'."\n";
echo ' <td class="text_medium" style="padding:5px;">'.mi18n("Sort by").':</td>'."\n";
echo ' <td class="text_medium" style="padding:5px">';
echo ' <select name="CMS_VAR[4]">'."\n";
// erstellungszeit
if( ($lo_set["Art_SortBy"] == '') || ($lo_set["Art_SortBy"] == 'created') )
{ echo '<option value="created" selected>'.mi18n("Add Date").'</option>'."\n"; }
else
{ echo '<option value="created">'.mi18n("Add Date").'</option>'."\n"; }
// letzte aenderung
if( $lo_set["Art_SortBy"] == 'lastmodified' )
{ echo '<option value="lastmodified" selected>'.mi18n("Last Modified Date").'</option>'."\n"; }
else
{ echo '<option value="lastmodified">'.mi18n("Last Modified Date").'</option>'."\n"; }
// veroeffentlichungs datum
if( $lo_set["Art_SortBy"] == 'published' )
{ echo '<option value="published" selected>'.mi18n("Published Date").'</option>'."\n"; }
else
{ echo '<option value="published">'.mi18n("Published Date").'</option>'."\n"; }
// artikelsorierung
if( $lo_set["Art_SortBy"] == 'artsort' )
{ echo '<option value="artsort" selected>'.mi18n("Articlesort").'</option>'."\n"; }
else
{ echo '<option value="artsort">'.mi18n("Articlesort").'</option>'."\n"; }
// title
if( $lo_set["Art_SortBy"] == 'title' )
{ echo '<option value="title" selected>'.mi18n("Title").'</option>'."\n"; }
else
{ echo '<option value="title">'.mi18n("Title").'</option>'."\n"; }
echo ' </select>'."\n";
echo ' </td>'."\n";
echo '</tr>'."\n";
//----------------------------------------------------------------
// art - sortdir
echo '</tr>'."\n";
echo ' <td class="text_medium" style="padding:5px;">'.mi18n("ascending sorting").':</td>'."\n";
echo ' <td style="padding:5px;">'."\n";
if( strtolower($lo_set["Art_SortDir"]) == 'desc' )
{ echo '<input type="radio" name="CMS_VAR[5]" value="asc"/>'."\n"; }
else
{ echo '<input type="radio" name="CMS_VAR[5]" value="asc" checked/>'."\n"; }
echo ' </td>'."\n";
echo '</tr>'."\n";
echo '<tr>'."\n";
echo ' <td class="text_medium" style="padding:5px;">'.mi18n("descending sorting").':</td>'."\n";
echo ' <td style="padding:5px;">'."\n";
if( strtolower($lo_set["Art_SortDir"]) == 'desc' )
{ echo '<input type="radio" name="CMS_VAR[5]" value="desc" checked/>'."\n"; }
else
{ echo '<input type="radio" name="CMS_VAR[5]" value="desc"/>'."\n"; }
echo ' </td>'."\n";
echo '</tr>'."\n";
//----------------------------------------------------------------
// trennlinie
echo '<tr><td colspan="2"><hr></td></tr>'."\n";
//----------------------------------------------------------------
// art - limit
echo '<tr>'."\n";
echo ' <td class="text_medium" style="padding:5px;">'.mi18n("Limit of article per site").':</td>'."\n";
echo ' <td style="padding:5px;"><input type="text" name="CMS_VAR[6]" value="'.$lo_set["Art_Limit"].'"></td>'."\n";
echo '</tr>'."\n";
// art - maxart
echo '<tr>'."\n";
echo ' <td class="text_medium" style="padding:5px;">'.mi18n("Show max article").':</td>'."\n";
echo ' <td style="padding:5px;"><input type="text" name="CMS_VAR[7]" value="'.$lo_set["Art_MaxArt"].'"></td>'."\n";
echo '</tr>'."\n";
// art - maxchar
echo '<tr>'."\n";
echo ' <td class="text_medium" style="padding:5px;">'.mi18n("Show max char for content").':</td>'."\n";
echo ' <td style="padding:5px;"><input type="text" name="CMS_VAR[8]" value="'.$lo_set["Art_MaxChar"].'"></td>'."\n";
echo '</tr>'."\n";
// art - artikelspezifikation
echo '<tr>'."\n";
echo ' <td class="text_medium" style="padding:5px;" valign="top">'.mi18n("Filter articlespecification").':</td>'."\n";
echo ' <td style="padding:5px;">';
echo ' <input id="CMS_VAR18" type="hidden" name="CMS_VAR[18]" value="">'."\n";
// uppsi keine artikelspezifikation vorhanden
if( !$lo_dbobj->num_rows() )
{ echo mi18n("no articelspecification available"); }
else
{
echo '<select size="5" multiple onchange="javascript:document.getElementById(\'CMS_VAR18\').value=Func_GenerateSerialize(this);">'."\n";
while( $lo_dbobj->next_record() )
{
echo '<option value="'.$lo_dbobj->f('idartspec').'"';
if( in_array($lo_dbobj->f('idartspec'), $lo_tmparr_cms) )
{ echo ' selected'; }
echo '>'.$lo_dbobj->f('artspec').'</option>'."\n";
}
echo '</select>'."\n";
}
//----------------------------------------------------------------
// trennlinie
echo '<tr><td colspan="2"><hr></td></tr>'."\n";
//----------------------------------------------------------------
// art - incstart
echo '<tr>'."\n";
echo '<td class="text_medium" style="padding:5px;">'.mi18n("Include startarticle in list").':</td>'."\n";
echo ' <td style="padding:5px;"><input type="checkbox" name="CMS_VAR[9]" value="true"';
if( $lo_set["Art_IncStart"] == 'true' )
{ echo ' checked'; }
echo '></td>'."\n";
echo '</tr>'."\n";
//----------------------------------------------------------------
// trennlinie
echo '<tr><td colspan="2"><hr></td></tr>'."\n";
//----------------------------------------------------------------
// art - headline
echo '<tr>'."\n";
echo ' <td class="text_medium" style="padding:5px;">'.mi18n("Headline").': </td>'."\n";
echo ' <td class="text_medium" style="padding:5px;"><input type="text" name="CMS_VAR[10]" value="'.$lo_set["Art_Headline"].'">';
echo ' <span style="font-weight: bold; font-size: 90%;">{TITLE}</span>';
echo ' </td>'."\n";
echo '</tr>'."\n";
// art - date
// format fuer anzeige datumssortierung
echo '<tr>'."\n";
echo ' <td class="text_medium" style="padding:5px;">'.mi18n("Format 'sort by'").':</td>'."\n";
echo ' <td class="text_medium" style="padding:5px;"><input type="text" name="CMS_VAR[11]" value="'.$lo_set["Art_SortValueFormat"].'">';
echo ' <span style="font-weight: bold; font-size: 90%;">{SORTVALUE}</span>';
echo ' </td>'."\n";
echo '</tr>'."\n";
//----------------------------------------------------------------
// trennlinie
echo '<tr><td colspan="2"><hr></td></tr>'."\n";
//----------------------------------------------------------------
// art - showimg
echo '<tr>'."\n";
echo ' <td class="text_medium" style="padding:5px;">'.mi18n("show first image of article in list").':</td>'."\n";
echo ' <td style="padding:5px;"><input type="checkbox" name="CMS_VAR[12]" value="true"';
if( $lo_set["Art_ShowImg"] == 'true' )
{ echo ' checked'; }
echo '></td>'."\n";
echo '</tr>'."\n";
// art - imgwidth
echo '<tr>'."\n";
echo ' <td class="text_medium" style="padding:5px;">'.mi18n("Image width").': </td>'."\n";
echo ' <td style="padding:5px;"><input type="text" name="CMS_VAR[13]" value="'.$lo_set["Art_ImgWidth"].'" maxlength="3">px</td>'."\n";
echo '</tr>'."\n";
// art - imgheight
echo '<tr>'."\n";
echo ' <td class="text_medium" style="padding:5px;">'.mi18n("Image height").': </td>'."\n";
echo ' <td style="padding:5px;"><input type="text" name="CMS_VAR[14]" value="'.$lo_set["Art_ImgHeight"].'" maxlength="3">px</td>'."\n";
echo '</tr>'."\n";
//----------------------------------------------------------------
// trennlinie
echo '<tr><td colspan="2"><hr></td></tr>'."\n";
//----------------------------------------------------------------
// art - tpl, tplno
echo '<tr>'."\n";
echo ' <td class="text_medium" style="padding:5px;">'.mi18n("Name of templatefile").': </td>'."\n";
echo ' <td style="padding:5px;"><input type="text" name="CMS_VAR[15]" value="'.$lo_set["Art_Tpl"].'"></td>'."\n";
echo '</tr>'."\n";
echo '<tr>'."\n";
echo ' <td class="text_medium" style="padding:5px;">'.mi18n("Name of templatefile for 'no article found'").': </td>'."\n";
echo ' <td style="padding:5px;"><input type="text" name="CMS_VAR[16]" value="'.$lo_set["Art_TplNo"].'"></td>'."\n";
echo '</tr>'."\n";
echo '</table>'."\n";
?><?php
Code: Alles auswählen
<?php
/***********************************************
* CONTENIDO MODUL - OUTPUT
*
* Modulname: SubCategory Browser (SCB)
* Author(s): Rene Hankel
* Copyright: michse
* Created: 2006.03.30
* Version: 0.4
*
************************************************/
//----------------------------------------------------------------
// Include
cInclude('classes', 'class.article.php');
cInclude('includes', 'functions.api.string.php');
cInclude('includes', 'functions.api.images.php');
include_once($cfg["path"]["contenido"] . 'classes/class.template.php');
//----------------------------------------------------------------
// lokale vars
// variablen
$lo_dbobj;
$lo_tpl;
$lo_runvar = 0;
$lo_sql = '';
$lo_tmpstrg = '';
$lo_hrefadd = '';
$lo_select = '';
$idcat0 = (int)$lo_set["Cat_Id"];
// artikel
$lo_seite = 1;
$lo_limit = 0;
$lo_limitart = 0;
$lo_articleid = 0;
$lo_pagelnk = '';
$lo_href = '';
$lo_filename = '';
$lo_dirname= '';
$lo_teaserimghref = '';
$lo_imgname = '';
$lo_tplimg = '';
$lo_tplhref = '';
$lo_tplheadline = '';
$lo_tpltext = '';
$lo_page = (int)$_REQUEST['page'];
$lo_tmparr = array();
$lo_options = array();
$lo_pagearr = array();
$lo_tmparr_cms = array();
$lo_transarr = array ('<br>' => ' ', '<BR>' => ' ','<br/>' => ' ','<br />' => ' ','<BR/>' => ' ', '<BR />' => ' ');
//----------------------------------------------------------------
// get config vars
unset($lo_set);
$lo_set = array();
// kategorie
$lo_set["Cat_Id"] = "CMS_VALUE[0]";
$lo_set["Cat_SortBy"] = "CMS_VALUE[1]";
$lo_set["Cat_SortDir"] = "CMS_VALUE[2]";
$lo_set["Cat_TplMenu"] = "CMS_VALUE[3]";
$lo_set["Cat_Separator"] = "CMS_VALUE[17]";
// artikel
$lo_set["Art_SortBy"] = "CMS_VALUE[4]";
$lo_set["Art_SortDir"] = "CMS_VALUE[5]";
$lo_set["Art_Limit"] = "CMS_VALUE[6]";
$lo_set["Art_MaxArt"] = "CMS_VALUE[7]";
$lo_set["Art_MaxChar"] = "CMS_VALUE[8]";
$lo_set["Art_IncStart"] = "CMS_VALUE[9]";
$lo_set["Art_Headline"] = "CMS_VALUE[10]";
$lo_set["Art_SortValueFormat"] = "CMS_VALUE[11]";
$lo_set["Art_ShowImg"] = "CMS_VALUE[12]";
$lo_set["Art_ImgWidth"] = "CMS_VALUE[13]";
$lo_set["Art_ImgHeight"] = "CMS_VALUE[14]";
$lo_set["Art_Tpl"] = "CMS_VALUE[15]";
$lo_set["Art_TplNo"] = "CMS_VALUE[16]";
$lo_set["Art_Filter"] = "CMS_VALUE[18]";
//----------------------------------------------------------------
// default vars
// kategorie
$lo_default_cat_sortby = 'C.name';
$lo_default_cat_sortdir = 'desc';
$lo_default_cat_tplmenu = 'scb_catmenu.html';
$lo_default_cat_separator = ' → ';
// artikel
$lo_default_art_sortby = 'created';
$lo_default_art_sortdir = 'desc';
$lo_default_art_tpl = 'scb_art.html';
$lo_default_art_tplno = 'scb_artno.html';
$lo_default_art_limit = 5;
$lo_default_art_maxart = 50;
$lo_default_art_maxchar = 200;
$lo_default_art_imgwidth = 200;
$lo_default_art_imgheight = 200;
$lo_default_art_sortvalue = '%Y.%m.%d';
$lo_art_filter_seperator = '<~>';
//----------------------------------------------------------------
// Base settings
// cat - sortby
if(
($lo_set["Cat_SortBy"] != 'C.name') &&
($lo_set["Cat_SortBy"] != 'C.created') &&
($lo_set["Cat_SortBy"] != 'C.lastmodified')
)
{ $lo_set["Cat_SortBy"] = $lo_default_cat_sortby; }
// cat - sortdir
if( ($lo_set["Cat_SortDir"] != 'desc') && ($lo_set["Cat_SortDir"] != 'asc') )
{ $lo_set["Cat_SortDir"] = $lo_default_cat_sortdir; }
// cat - tpl
if( strlen($lo_set["Cat_TplMenu"]) == 0 )
{ $lo_set["Cat_TplMenu"] = $lo_default_cat_tplmenu; }
// cat - tpl
if( strlen($lo_set["Cat_Separator"]) == 0 )
{ $lo_set["Cat_Separator"] = $lo_default_cat_separator; }
//--------------------------
// art - sortby
if(
($lo_set["Art_SortBy"] != 'created') &&
($lo_set["Art_SortBy"] != 'lastmodified') &&
($lo_set["Art_SortBy"] != 'published') &&
($lo_set["Art_SortBy"] != 'artsort') &&
($lo_set["Art_SortBy"] != 'title')
)
{ $lo_set["Art_SortBy"] = $lo_default_art_sortby; }
// art - sortdir
if( ($lo_set["Art_SortDir"] != 'desc') && ($lo_set["Art_SortDir"] != 'asc') )
{ $lo_set["Art_SortDir"] = $lo_default_art_sortdir; }
// art - template
if( strlen($lo_set["Art_Tpl"]) == 0 )
{ $lo_set["Art_Tpl"] = $lo_default_art_tpl; }
// art - template no art
if( strlen($lo_set["Art_TplNo"]) == 0 )
{ $lo_set["Art_TplNo"] = $lo_default_art_tplno; }
// art - limit
if( (int)$lo_set["Art_Limit"] <= 0 )
{ $lo_set["Art_Limit"] = $lo_default_art_limit; }
// art - max art
if( (int)$lo_set["Art_MaxArt"] <= 0 )
{ $lo_set["Art_MaxArt"] = $lo_default_art_maxart; }
// art - maxchar
if( (int)$lo_set["Art_MaxChar"] < 0 )
{ $lo_set["Art_MaxChar"] = $lo_default_art_maxchar; }
elseif( strlen($lo_set["Art_MaxChar"]) == 0 )
{ $lo_set["Art_MaxChar"] = 0; }
if( (int)$lo_set["Art_ImgWidth"] <= 0 )
{ $lo_set["Art_ImgWidth"] = $lo_default_art_imgwidth; }
if( (int)$lo_set["Art_ImgHeight"] <= 0 )
{ $lo_set["Art_ImgHeight"] = $lo_default_art_imgheight; }
if( strlen($lo_set["Art_SortValueFormat"]) == 0 )
{ $lo_set["Art_SortValueFormat"] = $lo_default_art_sortvalue; }
// serialisierte var exploden, wenn vorhanden
if( strlen($lo_set["Art_Filter"]) != 0 )
{ $lo_tmparr_cms = (explode($lo_art_filter_seperator, $lo_set["Art_Filter"])); }
//----------------------------------------------------------------
// obj erstellen
// template-obj
if ( !is_object($lo_tpl) )
{ $lo_tpl = new Template; }
// db-obj
if ( !is_object($lo_dbobj) )
{ $lo_dbobj = new DB_Contenido; }
//--------------------------------------------------------------------------------
// aktuelle auswahl als array aufbauen
//--------------------------------------------------------------------------------
$lo_runvar = 0;
while( true )
{
$lo_tmpstrg = 'idcat'.(string)$lo_runvar;
// der anfangsknoten ist immer idcat0 -> konfigurierte kategorie
if( $lo_runvar == 0 )
{ $_REQUEST[$lo_tmpstrg] = (int)$lo_set["Cat_Id"]; }
// keine naechst hoehere idcat vorhanden
if( $_REQUEST[$lo_tmpstrg] == '' )
{ break; }
//-----------------------------
// sql zusammenbauen;
$lo_sql = 'SELECT A.idcat, C.name, B.parentid, count(D.idcat) AS sub ';
$lo_sql .= 'FROM '.$cfg["tab"]["cat_tree"].' AS A ';
$lo_sql .= 'LEFT OUTER JOIN '.$cfg["tab"]["cat"].' AS B ';
$lo_sql .= ' ON A.idcat = B.idcat ';
$lo_sql .= 'LEFT OUTER JOIN '.$cfg["tab"]["cat_lang"].' AS C ';
$lo_sql .= ' ON A.idcat = C.idcat ';
$lo_sql .= 'LEFT OUTER JOIN '.$cfg["tab"]["cat"].' AS D ';
$lo_sql .= ' ON A.idcat = D.parentid ';
$lo_sql .= 'WHERE B.idclient = \''.$client.'\' ';
$lo_sql .= ' AND C.idlang = \''.$lang.'\' ';
$lo_sql .= ' AND C.visible = \'1\' ';
$lo_sql .= ' AND B.parentid = '.$_REQUEST[$lo_tmpstrg].' ';
$lo_sql .= 'GROUP BY A.idcat, C.name, B.parentid ';
$lo_sql .= 'ORDER BY '.$lo_set["Cat_SortBy"].' '.$lo_set["Cat_SortDir"];
//-----------------------------
// sql ausfuehren
// echo $lo_sql.'<br>';
$lo_dbobj->query($lo_sql);
//-----------------------------
// durchlaufe ergebnisse-> array erstellen
while ( $lo_dbobj->next_record() )
{
$lo_tmparr[(int)$_REQUEST[$lo_tmpstrg]][$lo_dbobj->f('idcat')] = array( 'name' => $lo_dbobj->f("name"), 'sub' => $lo_dbobj->f("sub") );
}
$lo_runvar++;
}// end while
//echo '<pre>';print_r($lo_tmparr);echo '</pre>';
//--------------------------------------------------------------------------------
// 'menue' aufbauen
//--------------------------------------------------------------------------------
$lo_runvar = 0;
$lo_hrefadd .= 'front_content.php?idcat='.$idcat;
// und los
while( true )
{
$lo_vorgaenger = 'idcat'.(string)($lo_runvar-1);
$lo_aktuell = 'idcat'.(string)$lo_runvar;
$lo_nachfolger = 'idcat'.(string)($lo_runvar+1);
//echo '<br>';
//echo 'vor '.$lo_vorgaenger.'-'.$_REQUEST[$lo_vorgaenger].'<br>';
//echo 'jetzt'.$lo_aktuell.'-'.$_REQUEST[$lo_aktuell].'<br>';
//echo 'nach '.$lo_nachfolger.'-'.$_REQUEST[$lo_nachfolger].'<br>';
//-----------------------------------------------
// keine unterkategorie
if( !isset($_REQUEST[$lo_aktuell]) )
{
$lo_hrefadd .= '&'.$lo_vorgaenger.'='.$_REQUEST[$lo_vorgaenger];
break;
}
//-----------------------------------------------
// links erstellen
elseif( sizeof($lo_tmparr[ $_REQUEST[$lo_aktuell] ]) )
{
//-----------------------------------------------
// zusatzlichen link erstellen
if( !strlen($lo_hrefadd) )
{ $lo_hrefadd .= 'front_content.php?idcat='.$_REQUEST[$lo_aktuell]; }
else
{ $lo_hrefadd .= '&'.$lo_aktuell.'='.$_REQUEST[$lo_aktuell]; }
//-----------------------------------------------
// wenn punkt im array schon ausgewaehlt wurde, dann link
// erzeugen um erneute auswahl zu ermoeglichen
if( ($_REQUEST[$lo_nachfolger] != '') )
{
// pfeil erstellen
if( strlen($lo_href) != 0)
{ $lo_href .= $lo_set["Cat_Separator"]; }
// link erstellen
$lo_href .= '<a class="'.$lo_set["Cat_LinkMenu"].'" href="'.$lo_hrefadd.'">';
$lo_href .= $lo_tmparr[ $_REQUEST[$lo_aktuell] ][ $_REQUEST[$lo_nachfolger] ]['name'];
$lo_href .= '</a>';
}
//-----------------------------------------------
// wenn weitere kategorieauswahl moeglich ist
else
{
// pfeil erstellen
if( strlen($lo_href) != 0)
{ $lo_select .= $lo_set["Cat_Separator"]; }
// selectfeld init
$lo_select .= '<select onchange="parent.frames.top.location.href = this.value">'."\n";
$lo_select .= '<option value="'.$sess->url($lo_hrefadd).'">Kategorie wählen</option>'."\n";
// select erstellen
foreach ($lo_tmparr[ $_REQUEST[$lo_aktuell] ] as $key => $value)
{
$lo_select .= '<option value="';
// link
$lo_select .= $sess->url($lo_hrefadd.'&'.$lo_nachfolger.'='.$key);
$lo_select .= '"';
// ist eintrag ausgewaehlt
if( (int)$_REQUEST[$lo_nachfolger] == $key )
{ $lo_select .= ' selected>'; }
else
{ $lo_select .= '>'; }
// linkname
$lo_select .= $value['name'];
$lo_select .= '</option>'."\n";
}
$lo_select .= '</select>'."\n";
}
}
$lo_runvar++;
}// end while
//-----------------------------------------------
// template fuellen und erzeugen
$lo_tpl->reset();
$lo_tpl->set('s', 'LINK', $lo_href);
$lo_tpl->set('s', 'SELECT', $lo_select);
$lo_tpl->generate('templates/'.$lo_set["Cat_TplMenu"]);
//--------------------------------------------------------------------------------
// artikeliste aufbauen
//--------------------------------------------------------------------------------
// vorhanden artikelspezifikationen die online sind mit
// konfigurierten syncen
$lo_sql = 'SELECT SPEC.idartspec, SPEC.artspec, SPEC.client, SPEC.lang ';
$lo_sql.= 'FROM '.$cfg['tab']['art_spec'].' AS SPEC ';
$lo_sql.= 'WHERE SPEC.client = \''.$client.'\' ';
$lo_sql.= 'AND SPEC.lang = \''.$lang.'\' ';
$lo_sql.= 'AND SPEC.online = \'1\' ';
$lo_sql.= 'ORDER BY SPEC.idartspec asc';
// artikelspezifikationen abfragen
$lo_dbobj->query($lo_sql);
// array aus artikelspezifikationen erstellen
while( $lo_dbobj->next_record() )
{ $lo_tmparr[] = $lo_dbobj->f('idartspec'); }
// array mit den werten fuellen die die konfiguriert wurden UND
// vorhanden und online sind
$lo_tmparr_cms = array_intersect($lo_tmparr, $lo_tmparr_cms);
//-----------------------------------------------
// allgemeine template sachen
$lo_tpl->reset();
$lo_tpl->set('s', 'TITLE', $lo_set["Art_Headline"]);
//-----------------------------------------------
// wenn 'idcat' vorhanden und nicht null
if( (strlen($_REQUEST[$lo_vorgaenger]) > 0) && ((int)$_REQUEST[$lo_vorgaenger] != 0) )
{
// optionsarray fur artikelabfrage erstellen
$lo_options['idcat'] = (int)$_REQUEST[$lo_vorgaenger];
// startartikel anzeigen?
if( $lo_set["Art_IncStart"] == 'true' )
{ $lo_options['start'] = true; }
else
{ $lo_options['start'] = false; }
// sortierung
$lo_options['order'] = $lo_set["Art_SortBy"];
// sortierungsrichtung
$lo_options['direction'] = $lo_set["Art_SortDir"];
// filter angeben?
if( count($lo_tmparr_cms) > 0 )
{
// option erzeugen
$lo_options['artspecs'] = $lo_tmparr_cms;
}
//----------------------------------------------------------------
// artikel abfragen
$lo_artlist = new ArticleCollection($lo_options);
//----------------------------------------------------------------
// falls artikel vorliegen
if ($lo_artlist->count > 0)
{
//----------------------------------------------------------------
// pruefe ob vorhanden artikelanzahl groesser ist als
// max angezeigt werden sollen
if( $lo_set["Art_MaxArt"] < $lo_artlist->count )
{ $lo_limitart = $lo_set["Art_MaxArt"]; }
else
{ $lo_limitart = $lo_artlist->count; }
//--------------------------------------------
// page seiten und offset erstellen
while( true )
{
// falls offset erreicht wurde, abbrechen
if( $lo_limit >= $lo_limitart )
{
// damit array wenigsten 0 werte enthaelt
if( count($lo_pagearr) == 0 )
{ $lo_pagearr[1] = 0;}
break;
}
// neue seite mit zugehoerigen offset einfuegen
$lo_pagearr[$lo_seite] = $lo_limit;
// offset errechnen
$lo_limit += $lo_set["Art_Limit"];
// seitenzahl erhoehen
$lo_seite += 1;
}
//----------------------------------------------------------------
// pruefe ob var 'page' in den moeglichen seitenangaben existiert
if( array_key_exists($lo_page, $lo_pagearr) )
{}
else
{ $lo_page = 1; }
//----------------------------------------------------------------
// durchlaufe alle gefundenen artikel
for( $i = 0; $i < $lo_limitart; $i++ )
{
// hole naechsten artikel
$lo_article = $lo_artlist->nextArticle();
//----------------------------------------------------------------
// zeige artikel an, wenn er innerhalb der zu zeigenden page liegt
if( ($i >= $lo_pagearr[$lo_page]) && ($i <($lo_pagearr[$lo_page]+$lo_set["Art_Limit"])) )
{
$lo_articleid = $lo_article->getField('idart');
$lo_tplimg = '';
//----------------------------------------------------------------
// falls bild angezeigt werden soll
if( $lo_set["Art_ShowImg"] == 'true' )
{
// hole artikelinhalt
$text_html = $lo_article->getContent('CMS_HTML', 1);
// suche nach bildern
$regEx = "/<img[^>]*?>.*?/i";
$match = array ();
preg_match($regEx, $text_html, $match);
// suche nach bildquelle und splite pfad auf
$regEx = "/(src)(=)(['\"]?)([^\"']*)(['\"]?)/i";
$img = array ();
preg_match($regEx, $match[0], $img);
$img_src = preg_split("/\//", $img[0]);
// finde dateinanem ohne endung
$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]);
$lo_imgname = $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;
$lo_imgname = preg_replace("/$suffix/", "", $img_name);
$lo_imgname = $lo_imgname.".[a-zA-Z]{3}";
}
}
$lo_teaserimghref = '';
//----------------------------------------------------------------
// bild vorhanden ist vorhanden
if( strlen($lo_imgname) > 0 )
{
$sql = 'SELECT * FROM '.$cfg["tab"]["upl"].' WHERE filename REGEXP \''.$lo_imgname.'\'';
$db->query($sql);
// bild info abfragen
if ($db->next_record())
{
$lo_filename = $db->f('filename');
$lo_dirname = $db->f('dirname');
}
// dateipfad zusammensetzen
$img_path = $cfgClient[$client]["upl"]["path"].$lo_dirname.$lo_filename;
// href des bildes erzeugen
$lo_teaserimghref = @capiImgScale($img_path, $lo_set["Art_ImgWidth"], $lo_set["Art_ImgHeight"], $crop = false, $expand = false, $cacheTime = 1000, $wantHQ = false);
} // end if strlen
//----------------------------------------------------------------
// falls href des bildes gefunden
if (strlen($lo_teaserimghref) > 0)
{ $lo_tplimg = '<img src="'.$lo_teaserimghref.'" alt="'.$lo_imgname.'">'; }
else
{ $lo_tplimg = ''; }
} // end if noimg
// head holen
$lo_tplheadline = trim( $lo_article->getContent('CMS_HTMLHEAD', 1) );
// <br> in ' ' umwandeln
$lo_tplheadline = strtr($lo_tplheadline, $lo_transarr);
// alle html-tags entfernen
$lo_tplheadline = trim( strip_tags($lo_tplheadline) );
$lo_tplhref = $sess->url('front_content.php?idcat='.(int)$_REQUEST[$lo_vorgaenger].'&idart='.$lo_articleid);
// zusammenfassung holen
$lo_tpltext = trim($lo_article->getField('summary'));
//----------------------------------------------------------------
// falls feld zusammenfassung leer ist, content holen
if (strlen($lo_tpltext) == 0)
{
// content holen
$lo_tpltext = trim( $lo_article->getContent('CMS_HTML', 1) );
// <br> in ' ' umwandeln
$lo_tpltext = strtr($lo_tpltext, $lo_transarr);
// alle html-tags entfernen
$lo_tpltext = trim( strip_tags($lo_tpltext) );
// wenn text laenger als gewuenscht ist
if( strlen($lo_tpltext) > $lo_set["Art_MaxChar"] )
{
// wenn text angezeigt werden soll
if( (int)$lo_set["Art_MaxChar"] > 0 )
{
$lo_tpltext = capiStrTrimAfterWord($lo_tpltext, (int)$lo_set["Art_MaxChar"]);
$lo_tpltext .= '...';
}
else
{ $lo_tpltext = ''; }
}
}
//----------------------------------------------------------------
// wenn sortierungsoption zeitwert ist, dann formatieren
if( ($lo_set["Art_SortBy"] == 'created') || ($lo_set["Art_SortBy"] == 'lastmodified') || ($lo_set["Art_SortBy"] == 'published') )
{ $lo_tpl->set('d', 'SORTVALUE', strftime($lo_set["Art_SortValueFormat"], strtotime($lo_article->getField($lo_set["Art_SortBy"]))) ); }
else
{ $lo_tpl->set('d', 'SORTVALUE', $lo_article->getField($lo_set["Art_SortBy"]) ); }
// andere templatevars
$lo_tpl->set('d', 'HEADLINE', $lo_tplheadline);
$lo_tpl->set('d', 'TEXT', $lo_tpltext);
$lo_tpl->set('d', 'HREF', $lo_tplhref);
$lo_tpl->set('d', 'IMG', $lo_tplimg);
$lo_tpl->next();
} // end for
}
//----------------------------------------------------------------
// pagelinks erstellen
foreach( $lo_pagearr as $lo_key => $lo_value)
{
$lo_href = $sess->url($lo_hrefadd.'&page='.$lo_key);
if( $lo_page == $lo_key )
{ $lo_pagelnk .= '<strong>'.$lo_key.'</strong> '; }
else
{ $lo_pagelnk .= '<a href="'.$lo_href.'">'.$lo_key.'</a> '; }
}
$lo_tpl->set('s', 'PAGE', $lo_pagelnk);
$lo_tpl->generate('templates/'.$lo_set["Art_Tpl"]);
}
//----------------------------------------------------------------
// keine artikel vorhanden
else
{ $lo_tpl->generate('templates/'.$lo_set["Art_TplNo"]); }
}
//-----------------------------------------------
// kategorie ungueltig
else
{ echo mi18n("Category invalid!"); }
?>