We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 10957
    • 32 Posts
    Hello,
    I’m new to modx - and enthusiastic -, trying to learn how to manage it. I have a practical situation for which I could not find solution in modx resource. I have this document tree :

    document1 (presentation)
    |- child1 (more presentation stuff)
    |- child2 (more presentation stuff)
    document2 (contact)

    from which I create a level 1 menu (doc1 and doc2, works) and a level 2 menu that appears when user clic on "document 1" menu item. For this level 2 menu I wish I have 3 items : one for the "base" page contained in document 1 (with different menu title) more child 1 an child2.
    So level 1 menu items would be for example "presentation"(doc1) and "contact"(doc2) and level 2 appearing when clic on "presentation" would be "general presentation" (doc1, active by default), "specific informations" (child1) and "more specific informations" (child2).

    Seems like I made complex the explanations of my simple case. Please ask me if I’m not clear, thanks.
      • 11975
      • 2,542 Posts
      Hi,

      there are several ways (as usual with modx ) to achieve the expected results

      One of them is to use PHx to change the wayfinder call
      For instance you could check if the current doc is a folder or not.

      [*isfolder:isnot=`1`:then=`WF_call_with_level_set_to_1`:else=`WF_call_with_level_set_to_2`*]

      Another way would be to create a TV (for instance a select) in which you store two options
      1level=={{chunk_name_containing_WF_level_1}}||2levels=={{chunk_name_containing_WF_level_2}}
      And then for each doc you apply the nav as you want it to appear

      About displaying the first child after a click on the folder label , check the redirectFirstChild Snippet


      hope that helps

      :-)
        Made with MODx : [url=http://www.copadel.com]copadel, fruits et l
        • 10957
        • 32 Posts
        Thank you very much Heliotrope !
        I have been playing with the tips you gave me. I will describe what I’ve done precisely so that other beginners can have profit :
        1. I have created a TV name subMenuTitle in my folder (presentation, doc1) in which I can fill the title of the sub menu
        2. I have added a chunck for outer WayFinder template :
        <ul id="sub-menu">
            [+phx:if=`[*isfolder*]`:is=`1`:then=`<li class="active"><a href="[~id~]">[[GetField? &docid=`[*id*]` &field=`subMenuTitle`]]</a></li>`:else=`<li><a href="[~parent~]">[[GetField? &docid=`[*parent*]` &field=`subMenuTitle`]]</a></li>`+]
            [+wf.wrapper+]
        </ul>
        

        In this chunk I used PHx as recommended by Heliotrope (I did not understand yet the functionnalities of this snippet, but I used it like a expression evaluator). If I am on the folder I’m getting its own submenu title, if I’m in a sub-menu, I’m getting the folder subMenuTitle.


        Something is not working : my [~id~] and [~parent~] are not interpreted and replaced by link to the documents. Why this ?

        Anyway, I think that using FirstChildRedirect snippet is a better solution, easier to configure and logical (I’m going to test it). Is there a documentation about most useful snippets with example of use ? (in which a beginner like me could have heard about FirstChildRedirect for example)
        Thanks.
          • 7231
          • 4,205 Posts
          Is there a documentation about most useful snippets with example of use ? (in which a beginner like me could have heard about FirstChildRedirect for example)
          I think that a lot of beginners get messed up with this, I know I have suffered a bit. Some of these only exist within the forum and sometimes deep within a post so you really need to search for them (or even in other language forums).

          However, having said that, it ultimately is OUR responsibility, as a community, to make this better. Adding a simple How-to to the wiki, no matter how simple it is, never hurts. However figuring out how to add stuff to the wiki might need a how-to of it’s own. grin grin
            [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

            Something is happening here, but you don&#39;t know what it is.
            Do you, Mr. Jones? - [bob dylan]
            • 11975
            • 2,542 Posts
            Something is not working : my [~id~] and [~parent~] are not interpreted and replaced by link to the documents. Why this ?

            Change your tags to [~[*id*]~] and [~[*parent*]~]


            :-)
              Made with MODx : [url=http://www.copadel.com]copadel, fruits et l
              • 10957
              • 32 Posts
              That worked, thank you for the help smiley !
                • 20289
                • 958 Posts
                @ dev_cw
                If you want to add something to the wiki, simply go to the wiki and append the URL with something that doesn’t exist!, this way you will get the edit page for the non existing page, simply start writing, after you wrote a page, save it!
                Thats it, you can add your article later to some specific category that relates the topic you have added.
                If you want some info on wiki’s how-to, just PM me, and ill be glad to help you. :-]
                  [img]http://i10.tinypic.com/52c4eir.gif[/img][/td]
                  [td][Wiki] [Persian support forum]
                  [SVN] [RTL SVN Branch] [bugs] [FishEye+Crucible] [Learn MODx!] | [My Google Code]
                  [font=tahoma][برای دسترسی به راهنمای فارسی به [url=http://www.modxcms.ir]