1 (edited by MBTY 2014-11-10 17:26:28)

Topic: Navigation menu plugin request

I want to add navigation menu with levels on my site
Here is example
http://zebroid.us/documentation/api/
look at vertical menu (right side)
I like this style of menus. It`s contain 2 levels. Second level is visible when we open page of this level.
For example.
On morfy we have content dir with tree:
\content\index.md                                                                 (title:Main Page)
\content\Categor_1\index.md                                               (title:Cat1)
\content\Categor_1\Some page of cat 1.md                         (title:Some page of cat 1)
\content\Categor_1\Another page of cat 1.md                     (title:Another page of cat 1)
\content\Categor_2\index.md                                               (title:Cat2)
\content\Categor_2\Some page of cat 2.md                         (title:Some page of cat 2)
\content\Categor_2\Another page of cat 2.md                     (title:Another page of cat 2)
Plugin scan all tree and builds menu:
+Main Page
+Cat1
+Cat2
When in click on Cat2 - i go on \content\Categor_2\index.md
After that menu must look like:

+Main Page
+Cat1
-Cat2
-Some page of cat 2
-Another page of cat 2

When i click on Cat1 - i go on \content\Categor_1\index.md
After that menu must look like:

+Main Page
-Cat1
-Some page of cat 1
-Another page of cat 1
+Cat2

When i click on Main Page - i go to index page. Menu:
+Main Page
+Cat1
+Cat2

I tried to edit breadcrumb plugin for this but i have not enough knowlegde oh php language. Help me please

2 (edited by MBTY 2014-11-10 22:40:18)

Re: Navigation menu plugin request

I made it!!!!(again)

Instructions:
plugins/navmenu/navmenu.php

addAction('navmenu', function() {
$pages = array_reverse(Morfy::factory()->getPages(CONTENT_PATH, 'url', 'DESC', array('404')));
foreach($pages as $page)
{
$path = trim($page['url'], '/');
$rank = count(explode('/', $path))-3;
$part=explode('/', $path);
if ($rank == 0) echo ''.$page['title'].'
'; if ($rank == 1) echo '➤ '.$page['title'].'
'; if ($rank == 2) if ($part[3]==Morfy::factory()->getUriSegment(0)) echo '    ⇛ '.$page['title'].'
'; if ($rank == 3) if ($part[4]==Morfy::factory()->getUriSegment(1)) echo '        ⇒ '.$page['title'].'
'; }; });

/config.php

'plugins' => array(
            'pagination',
            'tags',
            'navmenu',
        ),

Call:runAction('navmenu'); ?>