mirror of
https://github.com/e107inc/e107.git
synced 2025-08-02 20:57:26 +02:00
News Carousel Menu is now using the correct method (news class) to load news data.
This commit is contained in:
@@ -4,7 +4,10 @@
|
|||||||
*
|
*
|
||||||
* Carousel Menu
|
* Carousel Menu
|
||||||
*/
|
*/
|
||||||
if (!defined('e107_INIT')) { exit; }
|
if(!defined('e107_INIT'))
|
||||||
|
{
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if(is_string($parm))
|
if(is_string($parm))
|
||||||
@@ -27,8 +30,8 @@ $template = e107::getTemplate('news', 'news_menu', 'carousel', true, true);
|
|||||||
|
|
||||||
$nobody_regexp = "'(^|,)(" . str_replace(",", "|", e_UC_NOBODY) . ")(,|$)'";
|
$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 = "
|
$query = "
|
||||||
SELECT n.*, nc.category_id, nc.category_name, nc.category_sef, nc.category_icon,
|
SELECT n.*, nc.category_id, nc.category_name, nc.category_sef, nc.category_icon,
|
||||||
nc.category_meta_keywords, nc.category_meta_description
|
nc.category_meta_keywords, nc.category_meta_description
|
||||||
@@ -58,17 +61,40 @@ $query = "
|
|||||||
$query .= "
|
$query .= "
|
||||||
ORDER BY n.news_sticky DESC, n.news_datestamp DESC
|
ORDER BY n.news_sticky DESC, n.news_datestamp DESC
|
||||||
LIMIT ".$limit;
|
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))
|
if(empty($data))
|
||||||
{
|
{
|
||||||
e107::getMessage()->addDebug("No News items found with 'carousel' as the template ")->render();
|
e107::getMessage()->addDebug("No News items found with 'carousel' as the template ")->render();
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -116,8 +142,6 @@ else
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
e107::js('footer-inline', "
|
e107::js('footer-inline', "
|
||||||
clickEvent = false;
|
clickEvent = false;
|
||||||
$('#news-carousel').on('click', '#news-carousel-nav a', function() {
|
$('#news-carousel').on('click', '#news-carousel-nav a', function() {
|
||||||
|
Reference in New Issue
Block a user