/** * Returns the next news item on a page. * sets $_zp_current_zenpage_news to the next news item * Returns true if there is an new item to be shown * * @return bool */ function next_news() { global $_zp_zenpage, $_zp_current_zenpage_news, $_zp_current_zenpage_news_restore, $_zp_zenpage_articles, $_zp_current_category, $_zp_gallery, $_zp_current_search; if (func_num_args() != 0) { // These parameters are deprecated Zenpage_internal_deprecations::next_news(); } if (is_null($_zp_zenpage_articles)) { if (in_context(ZP_SEARCH)) { //note: we do not know how to paginate the search page, so for now we will return all news articles $_zp_zenpage_articles = $_zp_current_search->getArticles(ZP_ARTICLES_PER_PAGE, NULL, true, NULL, NULL); } else { if (in_context(ZP_ZENPAGE_NEWS_CATEGORY)) { $_zp_zenpage_articles = $_zp_current_category->getArticles(ZP_ARTICLES_PER_PAGE, NULL, false, NULL, NULL); } else { $_zp_zenpage_articles = $_zp_zenpage->getArticles(ZP_ARTICLES_PER_PAGE, NULL, false, NULL, NULL); } if (empty($_zp_zenpage_articles)) { return NULL; } } $_zp_current_zenpage_news_restore = $_zp_current_zenpage_news; } if (!empty($_zp_zenpage_articles)) { $news = array_shift($_zp_zenpage_articles); if (is_array($news)) { add_context(ZP_ZENPAGE_NEWS_ARTICLE); $_zp_current_zenpage_news = new ZenpageNews($news['titlelink']); return true; } } $_zp_zenpage_articles = NULL; $_zp_current_zenpage_news = $_zp_current_zenpage_news_restore; rem_context(ZP_ZENPAGE_NEWS_ARTICLE); return false; }