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

Made the navigation function a little more generic.

This commit is contained in:
Cameron
2012-12-11 16:04:32 -08:00
parent fb1a4e2b03
commit 8280dba7c8
2 changed files with 13 additions and 8 deletions

View File

@@ -2,6 +2,7 @@
function navigation_shortcode($parm='')
{
return e107::getNav()->frontend();
$data = e107::getNav()->getData(1);
return e107::getNav()->render($data);
}

View File

@@ -1176,7 +1176,7 @@ class e_navigation
/**
* Return a clean array structure for all links.
* Return a standardized clean array structure for all links.
*/
function getData($cat=1)
{
@@ -1225,17 +1225,21 @@ class e_navigation
// Render the Front-end Links.
function frontend($cat=1)
{
$links = $this->getData($cat);
/**
* Render the Front-end Links. (and eventually the back-end too)
* @param data array - see getData() above. Follows e107_links table format.
* @param template to use.
* TODO Support for side-menu templates and others.
*/
function render($data, $tmpl = 'navigation')
{
$sc = e107::getScBatch('navigation');
$template = e107::getCoreTemplate('navigation');
$template = e107::getCoreTemplate($tmpl);
$sc->template = $template; // parse the template to the shortcodes. (sub menus)
$text = $template['START'];
foreach($links as $lnk)
foreach($data as $lnk)
{
$sc->setVars($lnk);
$item = varset($lnk['link_sub']) ? $template['ITEM_SUBMENU'] : $template['ITEM'];