On March 26, 2019 we launched new MODX Forums. Please join us at the new MODX Community Forums.
Subscribe: RSS
  • Hi,

    I have posted this on Etomite forum, but if anyone can help here it would be great, as the templates/snippets will be run on modX.

    Here's a copy of my post>>

    I have tried various different configurations to get the following to work with ListMenu snippet. What I am trying to achieve is a design with 3 different menu blocks (all using LI style menus), where the siblings of all parents are shown, but in different blocks, and the path to top level is shown by retaining an onMenu state for all parent folders.

    The easiest way to explain is to look at an example at http://www.createloyalty.com.au
    * If you click on Rewards the Level 2 Menu appears
    * If you click on Customer Rewards the Level 3 menus appear
    [Note: This example does not trace the path back to root by retaining the onMenu status for parents. What I would like that is not in the example, is that when Customer Scheme A (Level 3) is active, both Customer Rewards, and Rewards retain onMenu class or id]

    Can anyone can configure or modify ListMenu (or help me) to achieve this? I will share with the community a generic template using this menu system if someone can help.

    Detailed explanation below.
    _______________
    1. Block 1 - Level 1 menus eg. Home, Create Txt, Rewards etc.
    * If you click on a page there is an menuOn class or id.
    * If the children (Level 2), or grandchildren (Level 3) of a that item are active then the menuOn class or id stays on.
    _______________
    2. Block 2 - Level 2 menus - eg. If you click on Rewards in Level 1, you can see Customer Rewards, Trade Rewards etc in this block (Level 2)
    * If there are no children to a Level 1 item then this block does not display. (click on Home to see)
    * When you click on a Level 2 item (eg. Rewards>Trade Rewards) there is a menuOn class or id, and the other Level 2 items remain on display.
    * If the children (Level 3) of a that item are active then the menuOn class or id stays on.
    _______________
    2. Block 3 - Level 3 menus - eg. If you click on Customer Rewards in Level 2, you can see Cusoter Scheme A, Customer Scheme B etc in this block (Level 3)
    * If there are no children to a Level 2 item then this block does not display. (click on Trade Rewards)
    * When you click on a Level 3 item (eg. Rewards>Customer Rewards>Customer Scheme A) there is an menuOn class or id, and the other Level 3 items remain on display.
    * Don't anticipate any further children....but maybe this could be configured so that further children etc are displayed in a nested list (see comments in Note below). I anticipate Level 3 would be always be vertical.

    "Its for modX" - not in my Etomite post smiley
    Regards

    Richard

    Note: In CMSimple you can set the template call (like a snippet parameter) with a very easy:
    <?php echo toc(1);?> 
    for Level 1, or
    <?php echo toc(2);?> 
    for a Level 2. You can also combine the blocks to show a nested list so that
    <?php echo toc(2,3);?> 
    shows Level2 and 3 in a nested list.
    • What you want I think is the most recent version of the ListSiteMap snippet, which does everythign you're talking about I think. You can limit how many levels deep it drills down, specify the starting directory and so on. Check it out and see if that works for you.
        Ryan Thrash, MODX Co-Founder
        Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
      • Thanks Ryan,

        I have tried this Snippet. The problem is that you can configure menus
        * to start at a particular folder (using theID) or
        * (in ListMenu) to start at a place relative to the page you are on,

        but not at a particular "depth" relative to the root. The simplicity of the proposed system is that it works with a single template, because the Snippet calls are the same on every page ie.
        * Block 1 - Show all Level 1
        * Block 2 - Show Level 2 if parent is active, or a sibling is active
        * Block 3 - Show Level 3 if parent is active, or sibling is active

        If I am missing something please come around a whack me with a 4 by 2 smiley

        Ricardosan