Sitemap
if (!function_exists('truncate'))
{
function truncate($string, $length = 80, $etc = '...', $break_words = false)
{
if ($length == 0)
return '';
if (strlen($string) > $length)
{
$length -= strlen($etc);
if (!$break_words)
$string = preg_replace('/\s+?(\S+)?$/', '', substr($string, 0, $length +1));
return substr($string, 0, $length).$etc;
}
else
return $string;
}
}
function ModulPrintCatList($categories, $printArticles, $printStartArticles, $showText) {
$TEXT_LENGTH = 150;
if(is_array($categories) && count($categories) > 0) {
echo '
';
foreach ($categories as $cat) {
if ($cat->isOnline()){
echo '- '.$cat->getName().'';
if(($showText && !$printArticles) || ($showText && $printArticles && !$printStartArticles) ){
//Anzeige des Startartikels (wenn online)
$art = $cat->getStartArticle();
if($art->isOnline()){
$article = new rex_article_content();
$article->setArticleId( $art->getId() );
$articleText = truncate( strip_tags( $article->getArticle()), $TEXT_LENGTH);
echo '
'.$articleText.'
';
}
}
if($printArticles) {
$articles = $cat->getArticles();
if(is_array($articles) && count($articles) > 0) {
$tmp_str = '';
foreach ($articles as $art) {
if( ($art->isOnline()&& !$art->isStartArticle()) || ($art->isOnline()&& $printStartArticles) ){
$tmp_str .= ' - '.$art->getName().'';
if($showText) {
$article = new rex_article_content();
$article->setArticleId( $art->getId() );
$articleText = truncate( strip_tags( $article->getArticle()), $TEXT_LENGTH);
$tmp_str .= '
'.$articleText.'
';
}
$tmp_str .= ' ';
}
}
if($tmp_str != ''){
echo '';
}
}
}
ModulPrintCatList($cat->getChildren(), $printArticles, $printStartArticles, $showText);
echo '';
}
}
echo '
';
}
}
// START Root Categories //
$categories = rex_category::getRootCategories();
if (is_array($categories) && count($categories) > 0){
ModulPrintCatList($categories,
("" == "show_articles"),
("" == "start_articles"),
("" == "show_text"));
}
?>