static function printNewsCategories($separator = '', $link = true, $print = true) { $text = ''; $categories = getNewsCategories(); $catcount = count($categories); if ($catcount != 0) { if (is_NewsType("news")) { $count = 0; foreach ($categories as $cat) { $count++; $catname = get_language_string($cat['cat_name']); if ($count >= $catcount) { $separator = ""; } else { $separator = ", "; } $url = getNewsCategoryURL($cat['cat_link']); $text .= ($link ? "<a href='{$url}'>" : "") . $catname . ($link ? "</a>" : "") . $separator; } } } if ($print) { echo $text; } return $text; }
/** * Prints the statistics Zenpage items as an unordered list * * @param int $number The number of news items to get * @param string $option "all" pages and articles * "news" for news articles * "pages" for pages * @param string $mode "popular" most viewed for pages, news articles and categories * "mostrated" for news articles and pages * "toprated" for news articles and pages * "random" for pages, news articles and categories * @param bool $showstats if the value should be shown * @param bool $showtype if the type should be shown * @param bool $showdate if the date should be shown (news articles and pages only) * @param bool $showcontent if the content should be shown (news articles and pages only) * @param bool $contentlength The shortened lenght of the content * @param string $sortdir "asc" for ascending or "desc" for descending (default) */ function printZenpageStatistic($number = 10, $option = "all", $mode = "popular", $showstats = true, $showtype = true, $showdate = true, $showcontent = true, $contentlength = 40, $sortdir = 'desc') { $stats = getZenpageStatistic($number, $option, $mode); $contentlength = sanitize_numeric($contentlength); switch ($mode) { case 'popular': $cssid = "'zenpagemostpopular'"; break; case 'mostrated': $cssid = "'zenpagemostrated'"; break; case 'toprated': $cssid = "'zenpagetoprated'"; break; case 'random': $cssid = "'zenpagerandom'"; break; } echo "<ul id={$cssid}>"; foreach ($stats as $item) { switch ($mode) { case 'popular': $statsvalue = $item['hitcounter']; break; case 'mostrated': $statsvalue = $item['total_votes']; break; case 'toprated': $statsvalue = $item['rating']; break; } switch ($item['type']) { case 'Page': $titlelink = html_encode(getPageURL($item['titlelink'])); case 'News': $titlelink = html_encode(getNewsURL($item['titlelink'])); break; case 'Category': $titlelink = html_encode(getNewsCategoryURL($item['titlelink'])); break; } echo '<li><a href = "' . $titlelink . '" title = "' . html_encode(getBare($item['title'])) . '"><h3>' . $item['title']; echo '<small>'; if ($showtype) { echo ' [' . $item['type'] . ']'; } if ($showstats && ($item['type'] != 'Category' && $mode != 'mostrated' && $mode != 'toprated')) { echo ' (' . $statsvalue . ')'; } echo '</small>'; echo '</h3></a>'; if ($showdate && $item['type'] != 'Category') { echo "<p>" . zpFormattedDate(DATE_FORMAT, strtotime($item['date'])) . "</p>"; } if ($showcontent && $item['type'] != 'Category') { echo '<p>' . truncate_string($item['content'], $contentlength) . '</p>'; } echo '</li>'; } echo '</ul>'; }
/** * Prints the parent items breadcrumb navigation for pages or categories * * @param string $mode 'pages or 'categories' * @param string $before Text to place before the breadcrumb item * @param string $after Text to place after the breadcrumb item */ function printZenpageItemsBreadcrumb($before = NULL, $after = NULL) { global $_zp_current_zenpage_page, $_zp_current_category; $parentitems = array(); if (is_Pages()) { //$parentid = $_zp_current_zenpage_page->getParentID(); $parentitems = $_zp_current_zenpage_page->getParents(); } if (is_NewsCategory()) { //$parentid = $_zp_current_category->getParentID(); $parentitems = $_zp_current_category->getParents(); } foreach ($parentitems as $item) { if (is_Pages()) { $pageobj = new ZenpagePage($item); $parentitemurl = html_encode(getPageLinkURL($item)); $parentitemtitle = $pageobj->getTitle(); } if (is_NewsCategory()) { $catobj = new ZenpageCategory($item); $parentitemurl = getNewsCategoryURL($item); $parentitemtitle = $catobj->getTitle(); } echo $before . "<a href='" . $parentitemurl . "'>" . $parentitemtitle . "</a>" . $after; } }