-
Multilevel custom navigation
I'm trying to do a custom submenu with custom items selected in site structure like this:
Code:
-Item 1 x
--iitm 1.1 x
--item 1.2 x
--item 1.3
--item 1.4
- item 2 x
--iitm 2.1 x
--item 2.2 x
--item 2.3
In original design it looks like [attachment=1:21s5k6a0]navigation-example.jpg[/attachment:21s5k6a0]
Custom Navigation module render it as one level list. [attachment=0:21s5k6a0]cutstom-navigation-example.jpg[/attachment:21s5k6a0]
Navigation Module doesn't support selection so it always show all children elements.
The question is - How to create custom selectable multilevel menu?
Maybe you can suggest me an extension?
-
Re: Multilevel custom navigation
You can create an alternate navigation structure with only redirects to the correct pages. then the menu would display the same as original, but you control which items are shown.
-
Re: Multilevel custom navigation
Quote:
Originally Posted by Ruud
You can create an alternate navigation structure with only redirects to the correct pages. then the menu would display the same as original, but you control which items are shown.
As I understand You mean to create a new node in site structure containing my new structure?
On this point I have not looked at this problem. It's maybe the way!
-
Re: Multilevel custom navigation
http://www.contao-community.org/view...vigation#p5550
I made a module a while ago to do this, its in a zip in the thread above.
Try it, no guarantees its what you're after, but i think it is.
-
Re: Multilevel custom navigation
I'm not 100% clear on what your goal is for the menu.
-Do you want all of the child links to hide until a parent is selected?
OR
-Do you want all of the child links to hide until a parent is hovered?
OR
-Do you want all children to be visible, but in a structure under it's parent? (like your 'Design Menu')
The reason you're getting them all in a straight line, even though they are on multiple levels, is because "Custom Navigation" styles it in this manner.
Custom Navigation in Contao is strictly a straight line of links of pages that you select. You can try to style it for levels, but you're better off using the standard navigation module.
In the 1st and 3rd example, you would use the standard Navigation module, but with the 2nd (hovering) you would be looking for an accordion type navigation (moo-menu?).
-
Re: Multilevel custom navigation
Quote:
Originally Posted by mechaflash
...
-Do you want all children to be visible, but in a structure under it's parent? (like your 'Design Menu')
The reason you're getting them all in a straight line, even though they are on multiple levels, is because "Custom Navigation" styles it in this manner.
Custom Navigation in Contao is strictly a straight line of links of pages that you select. You can try to style it for levels, but you're better off using the standard navigation module...
I wasn't sure about Custom Navigation module behavior until you post.
For the first try I did it like as Ruud said earlier.
I've created a new node containing menu structure I need. And all items are redirections to the correct pages. Added another one Navigation module pointing to the new node as the root.
-
Re: Multilevel custom navigation
Quote:
Originally Posted by ramjet
For Contao 2.9.3. it won't work properly. It show only first level from Selected items and don't create nested items.
-
Re: Multilevel custom navigation
dreel
every page in site structure has a property "Hide from navigation"... you can use standard "Navigation menu" module, which will output navigation with needed hierarchy without hidden pages
-
Re: Multilevel custom navigation
Quote:
For Contao 2.9.3. it won't work properly. It show only first level from Selected items and don't create nested items.
Sorry Dreel, you're right. :oops:
For some reason it no longer works. I'll try to find out why.
-
Re: Multilevel custom navigation
Quote:
Originally Posted by DyaGa
dreel
every page in site structure has a property "Hide from navigation"... you can use standard "Navigation menu" module, which will output navigation with needed hierarchy without hidden pages
It would be a dream if it would be so easy ) Structure items are used in two navigation blocks, so I can't hide some.
-
Re: Multilevel custom navigation
Quote:
Originally Posted by ramjet
Quote:
For Contao 2.9.3. it won't work properly. It show only first level from Selected items and don't create nested items.
Sorry Dreel, you're right. :oops:
For some reason it no longer works. I'll try to find out why.
ramjet, it would be cool if you made ??it compatible with the current version, by the way your work is still actual!
-
Re: Multilevel custom navigation
I've spent all day doing just that!
This one will allow multidomain installations to choose any pages across all domains.
One thing - If a page is orphaned (that is: you choose a subpage but NOT its parent) it won't be rendered. I might look at that later (catching strays and rendering them as Level_1 entries), but not for a while.
Also I haven't tested "Show protected items", but it should work. And I've only tested with Contao 2.9.4, but it should be ok with all 2.9 versions. Let me know if it suits (and works!).
Put in system/modules. No Install Tool update necessary. Appears as "Navigation::Selectable Navigation" in the Module Type dropdown. Same code rendering as the navigation menu, but inside .mod_selectnav instead of .mod_navigation.
EDIT: Zip removed - Enhanced version now here
http://www.contao-community.org/view...php?f=9&t=4034
-
Re: Multilevel custom navigation
This is a little hackish...
I noticed if you want to hide a page out of the navigation (without messing with user/group privileges), you can assign each page a class, then say if you had two trees of links (name = classname)
Tree1 Tree2
tree1 Link1 tree1 Link2 tree1 Link3 tree2 link1 tree2 link2 tree2 link3
And lets say you are on a page in tree1 and you do not want to show any links from tree2 BUT don't wish to create another module...
.tree1 .tree2
display: none
Reason that this works is because each link is assigned the classname you have given to the page, and of course the page itself is class="tree1". So it will hide anything that has class that includes "tree2.
-
Re: Multilevel custom navigation
dreel
then, why don't you use a custom nav. modules navigation? For example:
Code:
[Custom nav. module #1] => select "Item 1" => add class for this module "my-nav-level-1"
[Custom nav. module #2] => select items "Item 1.1, item 1.2" => add class for this module "my-nav-level-2"
[Custom nav. module #3] => select "Item 2" => add class for this module "my-nav-level-1"
[Custom nav. module #4] => select items "Item 2.1, item 2.2" => add class for this module "my-nav-level-2"
...
then, you will have this XHTML code:
Code:
<div class="mod_custnav my-nav-level-1">
<ul class="level_1">[*]<a ...>Item 1</a>[/list]
</div>
<div class="mod_custnav my-nav-level-2">
<ul class="level_1">[*]<a ...>Item 1.1</a>[*]<a ...>Item 1.2</a>[/list]
</div>
...
in this example you have unique class names my-nav-level-1, my-nav-level-2 ... style it as you need.
p.s... ??????, ??? ?? ??? :) ??? ???????, ??? ?????, ??? ?????. ??? ??????? ?????????? ????? ???????? ????????? ??????, ????? ??, ??????????? ?? ???????? ??????
-
Re: Multilevel custom navigation
Quote:
Originally Posted by ramjet
I've spent all day doing just that!
This one will allow multidomain installations to choose any pages across all domains.
One thing - If a page is orphaned (that is: you choose a subpage but NOT its parent) it won't be rendered. I might look at that later (catching strays and rendering them as Level_1 entries), but not for a while.
Also I haven't tested "Show protected items", but it should work. And I've only tested with Contao 2.9.4, but it should be ok with all 2.9 versions. Let me know if it suits (and works!).
Put in system/modules. No Install Tool update necessary. Appears as "Navigation::Selectable Navigation" in the Module Type dropdown. Same code rendering as the navigation menu, but inside .mod_selectnav instead of .mod_navigation.
Attached.[attachment=0:36q23att]selectnavContao2.9.zip[/attachment:36q23att]
:D
Ok. I'll try it this evening! BTW I've created a translation into Russian for your module, may be it's time to publish the module in contao repository?
I have an idea about a flexible custom selectable navigation module.
1. User can select the items he wants.
2. Any item has an indent property showing nesting level in new structure.
3. User can indent or undent the item to change it nest level.
4. An item has a number showing the order in structure, it allows to move item up and down.
5. User can move items up/down in structure using arrows as it presented in ce_list editor.
In editor each item has some controls to move it in structure: up, down, left, right arrows.
In a first approximation, the module can create a single-level list of all the elements of the structure and the user customize the items indent.
As the result we get a user defined menu structure that independent of real structure order.
-
Re: Multilevel custom navigation
Quote:
Originally Posted by mechaflash
This is a little hackish...
I noticed if you want to hide a page out of the navigation (without messing with user/group privileges), you can assign each page a class, then say if you had two trees of links (name = classname)
Tree1 Tree2
tree1 Link1 tree1 Link2 tree1 Link3 tree2 link1 tree2 link2 tree2 link3
And lets say you are on a page in tree1 and you do not want to show any links from tree2 BUT don't wish to create another module...
.tree1 .tree2
display: none
Reason that this works is because each link is assigned the classname you have given to the page, and of course the page itself is class="tree1". So it will hide anything that has class that includes "tree2.
mechaflash, it's not so good to use css to hide menu elements, there may be so much elements that page size will become thick.
-
Re: Multilevel custom navigation
Quote:
Originally Posted by DyaGa
dreel
then, why don't you use a custom nav. modules navigation? For example:
Code:
[Custom nav. module #1] => select "Item 1" => add class for this module "my-nav-level-1"
[Custom nav. module #2] => select items "Item 1.1, item 1.2" => add class for this module "my-nav-level-2"
[Custom nav. module #3] => select "Item 2" => add class for this module "my-nav-level-1"
[Custom nav. module #4] => select items "Item 2.1, item 2.2" => add class for this module "my-nav-level-2"
...
then, you will have this XHTML code:
Code:
<div class="mod_custnav my-nav-level-1">
<ul class="level_1">[*]<a ...>Item 1</a>[/list]
</div>
<div class="mod_custnav my-nav-level-2">
<ul class="level_1">[*]<a ...>Item 1.1</a>[*]<a ...>Item 1.2</a>[/list]
</div>
...
in this example you have unique class names my-nav-level-1, my-nav-level-2 ... style it as you need.
p.s... ??????, ??? ?? ??? :) ??? ???????, ??? ?????, ??? ?????. ??? ??????? ?????????? ????? ???????? ????????? ??????, ????? ??, ??????????? ?? ???????? ??????
DyaGa, Its will become an nightmare if I will create 4 modules for each page. There many pages in my site with this kind of menu.
[RU] ??????? ?? ???????? ?????, ????? ???? ? ??????? ?? ???? ?????????? ???????. ?? ? ??? ????????????? ????? ????????.
-
Re: Multilevel custom navigation
Quote:
Originally Posted by dreel
mechaflash, it's not so good to use css to hide menu elements, there may be so much elements that page size will become thick.
I did mention it was hackish :D . I know it's not good form to use CSS in this manner, but just thought I'd throw it out there if a permanent solution cannot be found.
-
Re: Multilevel custom navigation
Quote:
Originally Posted by mechaflash
I did mention it was hackish :D . I know it's not good form to use CSS in this manner, but just thought I'd throw it out there if a permanent solution cannot be found.
It would be the last way to do it, do it in ugly way )
-
Re: Multilevel custom navigation
Quote:
Originally Posted by ramjet
I've spent all day doing just that!
This one will allow multidomain installations to choose any pages across all domains.
One thing - If a page is orphaned (that is: you choose a subpage but NOT its parent) it won't be rendered. I might look at that later (catching strays and rendering them as Level_1 entries), but not for a while.
Also I haven't tested "Show protected items", but it should work. And I've only tested with Contao 2.9.4, but it should be ok with all 2.9 versions. Let me know if it suits (and works!).
Put in system/modules. No Install Tool update necessary. Appears as "Navigation::Selectable Navigation" in the Module Type dropdown. Same code rendering as the navigation menu, but inside .mod_selectnav instead of .mod_navigation.
Attached.[attachment=0:2u4l6qx4]selectnavContao2.9.zip[/attachment:2u4l6qx4]
:D
It works if only select the root level items and if you select a subroot item in a lower level it ignores.
I think there is no future for this module in that modification.
I'd like to suggest a new conception: fully customizable navigation.
Module loads the current site structure and view it to user.
Each item has a set of controls to move it up, down, left, right.
So user can create any navigation structure by moving items as he wants.
-
Re: Multilevel custom navigation
Quote:
It works if only select the root level items and if you select a subroot item in a lower level it ignores.
Yes, a selection needs a parent to attach to.
Quote:
I'd like to suggest a new conception: fully customizable navigation.
I like your suggestion, but I very much doubt it'll be on my project list :(
-
Re: Multilevel custom navigation
Quote:
Originally Posted by ramjet
Quote:
I'd like to suggest a new conception: fully customizable navigation.
I like your suggestion, but I very much doubt it'll be on my project list :(
Oh, I suggested it for everyone and maybe if I can have enough time I'll do it myself.
-
Re: Multilevel custom navigation
I've posted an enhanced version of [selectnav] that works across roots, deals with "orphans" by attaching them to the first available valid parent (or level_1 if no valid parent), and allows level_1 items to act as headers for their children if required.
Enhanced version now here
http://www.contao-community.org/view...php?f=9&t=4034
-
Re: Multilevel custom navigation
Rmjet, Its very COOL news! I'll use it in my new projects I think!
Thank you!
-
Re: Multilevel custom navigation
Its not as flexible as per your your suggestion, but hopefully it'll be flexible enough.
Let me know if it doesn't do what it should, or what you want it to.
I had a nightmare figuring out the repository, so just make sure you load the version thats there now ( as initially the package contained no files!)
I should finish another one soon called dropdown, which will do what selectnav does, and allow you to automatically generate and configure a javascript dropdown horizontal or vertical menu as well. I'll let you know when its done, so feedback is appreciated on selectnav as it uses the same logic.
-
Re: Multilevel custom navigation
I think such extension must be a standard part of The Contao. It provides extra flexibility in creating menus.
Thank for your time!
-
Re: Multilevel custom navigation
I've just put [dropdown] in the repository.