mirror of
https://github.com/e107inc/e107.git
synced 2025-08-01 20:30:39 +02:00
News Categories functions added to Sitelinks.
This commit is contained in:
@@ -23,6 +23,18 @@ class news_sitelink // include plugin-folder in the name.
|
|||||||
{
|
{
|
||||||
$links = array();
|
$links = array();
|
||||||
|
|
||||||
|
$links[] = array(
|
||||||
|
'name' => "News Category List",
|
||||||
|
'function' => "news_category_list",
|
||||||
|
'description' => ""
|
||||||
|
);
|
||||||
|
|
||||||
|
$links[] = array(
|
||||||
|
'name' => "News Category Pages",
|
||||||
|
'function' => "news_category_page",
|
||||||
|
'description' => ""
|
||||||
|
);
|
||||||
|
|
||||||
$links[] = array(
|
$links[] = array(
|
||||||
'name' => "Last 10 News Items",
|
'name' => "Last 10 News Items",
|
||||||
'function' => "last_ten",
|
'function' => "last_ten",
|
||||||
@@ -33,6 +45,68 @@ class news_sitelink // include plugin-folder in the name.
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function news_category_page()
|
||||||
|
{
|
||||||
|
return $this->news_category_list('category');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function news_cats() // BC
|
||||||
|
{
|
||||||
|
return $this->news_category_list();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function news_category_list($type=null)
|
||||||
|
{
|
||||||
|
$sql = e107::getDb();
|
||||||
|
$sublinks = array();
|
||||||
|
|
||||||
|
// $nobody_regexp = "'(^|,)(".str_replace(",", "|", e_UC_NOBODY).")(,|$)'";
|
||||||
|
$query = "SELECT * FROM #news_category ";
|
||||||
|
// $query .= "WHERE news_class REGEXP '".e_CLASS_REGEXP."' AND NOT (news_class REGEXP ".$nobody_regexp.") ";
|
||||||
|
$query .= " ORDER BY category_order ASC";
|
||||||
|
|
||||||
|
if($type == null)
|
||||||
|
{
|
||||||
|
$type = 'short';
|
||||||
|
}
|
||||||
|
|
||||||
|
$urlPath = 'news/list/'.$type;
|
||||||
|
|
||||||
|
if($sql->gen($query))
|
||||||
|
{
|
||||||
|
while($row = $sql->fetch())
|
||||||
|
{
|
||||||
|
$sublinks[] = array(
|
||||||
|
'link_name' => $row['category_name'],
|
||||||
|
'link_url' => e107::getUrl()->create($urlPath, $row, array('allow' => 'category_sef,category_name,category_id')), // 'news.php?extend.'.$row['news_id'],
|
||||||
|
'link_description' => $row['category_meta_description'],
|
||||||
|
'link_button' => '',
|
||||||
|
'link_category' => '',
|
||||||
|
'link_order' => '',
|
||||||
|
'link_parent' => '',
|
||||||
|
'link_open' => '',
|
||||||
|
'link_class' => 0
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
$sublinks[] = array(
|
||||||
|
'link_name' => LAN_MORE,
|
||||||
|
'link_url' => e107::getUrl()->create('news/list/all'),
|
||||||
|
'link_description' => '',
|
||||||
|
'link_button' => '',
|
||||||
|
'link_category' => '',
|
||||||
|
'link_order' => '',
|
||||||
|
'link_parent' => '',
|
||||||
|
'link_open' => '',
|
||||||
|
'link_class' => 0
|
||||||
|
);
|
||||||
|
|
||||||
|
return $sublinks;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function last_ten()
|
function last_ten()
|
||||||
{
|
{
|
||||||
@@ -75,6 +149,8 @@ class news_sitelink // include plugin-folder in the name.
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user