mirror of
https://github.com/e107inc/e107.git
synced 2025-07-29 19:00:26 +02:00
Made the navigation function a little more generic.
This commit is contained in:
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
function navigation_shortcode($parm='')
|
function navigation_shortcode($parm='')
|
||||||
{
|
{
|
||||||
return e107::getNav()->frontend();
|
$data = e107::getNav()->getData(1);
|
||||||
|
return e107::getNav()->render($data);
|
||||||
}
|
}
|
||||||
|
|
@@ -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)
|
function getData($cat=1)
|
||||||
{
|
{
|
||||||
@@ -1225,17 +1225,21 @@ class e_navigation
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Render the Front-end Links.
|
/**
|
||||||
function frontend($cat=1)
|
* Render the Front-end Links. (and eventually the back-end too)
|
||||||
{
|
* @param data array - see getData() above. Follows e107_links table format.
|
||||||
$links = $this->getData($cat);
|
* @param template to use.
|
||||||
|
* TODO Support for side-menu templates and others.
|
||||||
|
*/
|
||||||
|
function render($data, $tmpl = 'navigation')
|
||||||
|
{
|
||||||
$sc = e107::getScBatch('navigation');
|
$sc = e107::getScBatch('navigation');
|
||||||
$template = e107::getCoreTemplate('navigation');
|
$template = e107::getCoreTemplate($tmpl);
|
||||||
$sc->template = $template; // parse the template to the shortcodes. (sub menus)
|
$sc->template = $template; // parse the template to the shortcodes. (sub menus)
|
||||||
|
|
||||||
$text = $template['START'];
|
$text = $template['START'];
|
||||||
|
|
||||||
foreach($links as $lnk)
|
foreach($data as $lnk)
|
||||||
{
|
{
|
||||||
$sc->setVars($lnk);
|
$sc->setVars($lnk);
|
||||||
$item = varset($lnk['link_sub']) ? $template['ITEM_SUBMENU'] : $template['ITEM'];
|
$item = varset($lnk['link_sub']) ? $template['ITEM_SUBMENU'] : $template['ITEM'];
|
||||||
|
Reference in New Issue
Block a user