mirror of
https://github.com/e107inc/e107.git
synced 2025-08-08 23:56:58 +02:00
Additional {NAVIGATION} shortcode parms. eg. {NAVIGATION: type=main&layout=footer&flat=1&noempty=1} will flatten sublinks and remove links with no URL or '#'. Dynamic sublinks (functions) currently not supported.
This commit is contained in:
@@ -44,8 +44,7 @@
|
||||
$nav = e107::getNav();
|
||||
|
||||
$template = e107::getCoreTemplate('navigation', $tmpl);
|
||||
$data = $nav->initData($category);
|
||||
// $data = $nav->collection($category);
|
||||
$data = $nav->initData($category,$parm);
|
||||
|
||||
return $nav->render($data, $template);
|
||||
|
||||
|
@@ -1647,18 +1647,41 @@ i.e-cat_users-32{ background-position: -555px 0; width: 32px; height: 32px; }
|
||||
* --------------- CODE-EFFICIENT APPROACH -------------------------
|
||||
* FIXME syscache
|
||||
*/
|
||||
public function initData($cat=1)
|
||||
public function initData($cat=1, $opt=array())
|
||||
{
|
||||
$sql = e107::getDb('sqlSiteLinks');
|
||||
|
||||
$ins = ($cat > 0) ? " link_category = ".intval($cat)." AND " : "";
|
||||
|
||||
$query = "SELECT * FROM #links WHERE ".$ins." ((link_class >= 0 AND link_class IN (".USERCLASS_LIST.")) OR (link_class < 0 AND link_class NOT IN (".USERCLASS_LIST.")) ) ORDER BY link_order,link_parent ASC";
|
||||
|
||||
$outArray = array();
|
||||
$data = $sql->retrieve($query,true);
|
||||
|
||||
if(!empty($opt['flat']))
|
||||
{
|
||||
$newArr = array();
|
||||
foreach($data as $row)
|
||||
{
|
||||
//$tmp = $this->isDynamic($row); //FIXME TODO Flatten dynamic links and add to $newArr
|
||||
|
||||
if(!empty($opt['noempty']) && (empty($row['link_url']) || $row['link_url'] === '#'))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
$newArr[] = $row;
|
||||
|
||||
}
|
||||
|
||||
return $newArr;
|
||||
}
|
||||
|
||||
|
||||
$ret = $this->compile($data, $outArray);
|
||||
|
||||
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user