1
0
mirror of https://github.com/e107inc/e107.git synced 2025-07-31 03:40:37 +02:00

News Carousel Menu is now using the correct method (news class) to load news data.

This commit is contained in:
Cameron
2017-02-04 10:29:35 -08:00
parent 69e5677ba3
commit 90e3796919

View File

@@ -4,7 +4,10 @@
*
* Carousel Menu
*/
if (!defined('e107_INIT')) { exit; }
if(!defined('e107_INIT'))
{
exit;
}
if(is_string($parm))
@@ -27,8 +30,8 @@ $template = e107::getTemplate('news', 'news_menu', 'carousel', true, true);
$nobody_regexp = "'(^|,)(" . str_replace(",", "|", e_UC_NOBODY) . ")(,|$)'";
e107::getDebug()->log("News Carousel Menu ".print_a($parms,true));
// e107::getDebug()->log("News Carousel Menu ".print_a($parms,true));
/*
$query = "
SELECT n.*, nc.category_id, nc.category_name, nc.category_sef, nc.category_icon,
nc.category_meta_keywords, nc.category_meta_description
@@ -58,17 +61,40 @@ $query = "
$query .= "
ORDER BY n.news_sticky DESC, n.news_datestamp DESC
LIMIT ".$limit;
*/
$news = e107::getObject('e_news_tree'); // get news class.
$cat = !empty($parms['category']) ? intval($parms['category']) : null;
$data = $sql->retrieve($query,true);
$opts = array(
'db_order' => 'n.news_sticky DESC, n.news_datestamp DESC',
'db_limit' => $limit, // default is 10
'db_where' => " 1 "
);
if(vartrue($parms['source']) === 'assigned')
{
$opts['db_where'] = "FIND_IN_SET(5,n.news_render_type) ";
}
if(vartrue($parms['source']) === 'sticky')
{
$opts['db_where'] = "n.news_sticky = 1 ";
}
$opts['db_where'] .= " AND n.news_thumbnail != '' ";
$data = $news->loadJoinActive($cat, false, $opts)->toArray();
// $data = $sql->retrieve($query,true);
if(empty($data))
{
e107::getMessage()->addDebug("No News items found with 'carousel' as the template ")->render();
return;
}
@@ -116,8 +142,6 @@ else
}
e107::js('footer-inline', "
clickEvent = false;
$('#news-carousel').on('click', '#news-carousel-nav a', function() {