\n"); add_to_head(""); $tpl = \PHPFusion\Template::getInstance('news'); $tpl->set_template(__DIR__.'/html/news.html'); $tpl->set_locale(fusion_get_locale()); $tpl->set_tag('opentable', fusion_get_function('opentable', $locale['news_0004'])); $tpl->set_tag('closetable', fusion_get_function('closetable')); $tpl->set_tag('news_cat_name', $info['news_cat_name']); $tpl->set_tag('pagenav', ''); // Carousel -- make it just sticky $ni_html = ''; $carousel = FALSE; if (!empty($info['news_items'])) { if ($info['news_total_rows'] > $news_settings['news_pagination']) { $type_start = isset($_GET['type']) ? "type=".$_GET['type']."&" : ''; $cat_start = isset($_GET['cat_id']) ? "cat_id=".$_GET['cat_id']."&" : ''; $tpl->set_tag('pagenav', makepagenav($_GET['rowstart'], $news_settings['news_pagination'], $info['news_total_rows'], 3, INFUSIONS."news/news.php?".$cat_start.$type_start)); } $i = 0; $x = 1; foreach ($info['news_items'] as $news) { $news['news_profile_link'] = profile_link($news['user_id'], $news['user_name'], $news['user_status'], '', FALSE); $news['news_news'] = fusion_first_words($news['news_news'], 20); $news['news_link'] = INFUSIONS.'news/news.php?readmore='.$news['news_id']; $news['news_phpdate'] = date('c', $news['news_date']); $news['news_date'] = showdate('newsdate', $news['news_date']); //2013-02-14T20:26:08 // Carousel Item if ($news['news_sticky']) { if ($news['news_image_src'] && file_exists($news['news_image_src'])) { $carousel = TRUE; $news['carousel_active'] = ($i == 0 ? ' class="active"' : ''); $news['carousel_item_active'] = ($i == 0 ? ' active' : ''); $tpl->set_block('carousel_item', $news); $tpl->set_block('carousel_indicators', [ 'indicator_num' => $i, 'indicator_class' => $news['carousel_active'] ]); } } else { $news['news_news'] = strip_tags($news['news_news']); // Add support compatibility for render_news if (function_exists('render_news')) { ob_start(); render_news($news['news_subject'], $news['news_news'], $news); $ni_html .= ob_get_clean(); } else { $news['news_admin_actions'] = ''; if ($x > 6) { $x = 1; } $x_logic = (empty($x % 3) or empty($x % 4) ? TRUE : FALSE); if ($x === 6) { $x_logic = FALSE; } $ntpl = \PHPFusion\Template::getInstance('news_item'); $ntpl->set_template(__DIR__.'/html/news_item.html'); $ntpl->set_locale(fusion_get_locale()); $block_name = ($x_logic === TRUE ? 'news_item_lg' : 'news_item_sm'); $ntpl->set_block($block_name, $news); $output = $ntpl->get_output(); $ni_html .= $output; $x++; } } $i++; } } else { $ntpl = \PHPFusion\Template::getInstance('news_item'); $ntpl->set_template(__DIR__.'/html/news_item.html'); $ntpl->set_locale(fusion_get_locale()); $ntpl->set_block('no_news', []); $output = $ntpl->get_output(); $ni_html = $output; } $tpl->set_tag("news_items", $ni_html); if ($carousel) { $tpl->set_block('carousel_1_start', []); $tpl->set_block('carousel_2_start', []); $tpl->set_block('carousel_3_start', []); $tpl->set_block('carousel_1_end', []); $tpl->set_block('carousel_2_end', []); $tpl->set_block('carousel_3_end', []); } $tpl->set_tag('breadcrumb', render_breadcrumbs()); $tpl->set_tag('last_update', !empty($info['news_last_updated']) ? $info['news_last_updated'] : $locale['na']); // Use Navbar $i = 1; $sec_nav = []; foreach ($info['news_filter'] as $link => $title) { $sec_nav[0]['fltr_'.$i] = [ 'link_id' => 'fltr_'.$i, 'link_name' => $title, 'link_active' => ((!isset($_GET['type']) && $i == '0') || isset($_GET['type']) && stristr($link, $_GET['type']) ? 'active' : ''), 'link_url' => $link, ]; $i++; } $nav = []; if (!empty($info['news_categories'])) { $nav[0]['link_all'] = [ 'link_id' => 'link_all', 'link_active' => (!isset($_GET['cat_id']) ? 'active' : ''), 'link_name' => $locale['news_0018'], 'link_url' => INFUSIONS.'news/news.php', ]; foreach ($info['news_categories'] as $subID => $subData) { foreach ($subData as $cat_id => $catData) { $cat_id = $cat_id ?: '012'; $nav[$subID][$cat_id] = [ 'link_id' => $cat_id, 'link_name' => $catData['name'], 'link_url' => INFUSIONS.'news/news.php?cat_id='.$cat_id, 'link_active' => (isset($_GET['cat_id']) && $_GET['cat_id'] == $cat_id ? 'active' : ''), ]; } } } $tpl->set_tag('menu', \PHPFusion\SiteLinks::setSubLinks([ 'id' => 'news-nav', 'navbar_class' => 'navbar-default', 'locale' => fusion_get_locale(), 'links_per_page' => 4, 'grouping' => 5, 'callback_data' => $nav, 'additional_data' => $sec_nav, ])->showSubLinks()); echo $tpl->get_output(); } } if (!function_exists('render_news_item')) { /** * News Item Page Template * * @param $info */ function render_news_item($info) { $locale = fusion_get_locale(); $news_settings = \PHPFusion\News\NewsServer::get_news_settings(); $data = $info['news_item']; add_to_head(""); add_to_head(""); add_to_head(""); add_to_footer(''); opentable($locale['news_0004']); echo render_breadcrumbs(); echo ""; echo "
\n"; if (!empty($data['news_admin_actions'])) { $admin_actions = $data['news_admin_actions']; echo "
"; echo " ".$admin_actions['edit']['title']." \n"; echo " ".$admin_actions['delete']['title']."\n"; echo "
\n"; } echo "

".$data['news_subject']."

\n"; echo "
\n"; if ($data['news_image_src']) { echo " ".$data["; } echo $data['news_news']; echo $data['news_extended']; echo "
\n"; echo $data['news_pagenav']; if (!empty($data['news_gallery'])) { echo '
'; openside(fusion_get_locale('news_0019')) ?>
$news_image) : ?>
\n"; echo " ".profile_link($data['user_id'], $data['user_name'], $data['user_status'])."\n"; echo " ".showdate("newsdate", $data['news_datestamp'])."\n"; echo " ".number_format($data['news_reads'])."\n"; if ($data['news_allow_comments'] && fusion_get_settings('comments_enabled') == 1) { echo ' '.$data['news_display_comments']; } if ($data['news_allow_ratings'] && fusion_get_settings('ratings_enabled') == 1) { echo $data['news_display_ratings']; } echo " ".$locale['print'].""; echo ""; echo ""; echo !isset($_GET['readmore']) && $data['news_ext'] == "y" ? "
\n".$locale['news_0001']."\n
\n" : ""; echo $data['news_show_comments'] ? "
".$data['news_show_comments']."\n" : ''; echo $data['news_show_ratings'] ? "
".$data['news_show_ratings']."\n" : ''; echo "
\n"; closetable(); } }