We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 2231
    • 10 Posts
    Hello all,

    First of all Ive never used any CMS systems, I only code myself, thus Im stuck on finding how to edit the top menu?

    My client required to edit it, and I have no clue about modx.

    Currently the page menu outputs as:
    <UL id=horizontal-multilevel-menu>
    <ul>
    <LI><A class=root-item-selected href="whatever">Home</A></LI>
    <LI><A class=root-item href="/about">aboutС</A></LI>
    <LI><A class=root-item href="/clients">clients</A></LI>
    <LI><A class=root-item href="/partners">partners</A></LI>
    ..etc
    </ul> </UL>

    /no clue why is it double <ul>, so dont ask/

    Ive tried searching for a word "horizontal-multilevel-menu" with Dreamweaver and it found nothing in the whole folder. So many complicated things to just add another link! does this whole list pulls out from db ?


    HOW do I add a new link in the end BUT with an ONLICK avent to this unordered list?? Is this possible to do manually, editing the php file or not?

    Im trying to add a link that will trigger a div overlay window.

    forgot to add:


    $modx_version = ’1.0.2’; // Current version
    $modx_branch = ’Evolution’;
      • 2740
      • 95 Posts
      Without seeing the template Html code it’s very difficult to give you an answer.

      Login to your site, then Elements > Manage Elements > Template

      Then choose your template and copy the Html and post it on here. If no Html is included in your template get the code from the chunks listed.

      If you know Html you’ve have no problem understanding MODx templates.
        • 3749
        • 24,544 Posts
        If it’s a MODX site, the odds are that the menu is generated with the Wayfinder snippet.

        If so, you might be able to add your extra menu item in the Wayfinder outer Tpl chunk.

          Did I help you? Buy me a beer
          Get my Book: MODX:The Official Guide
          MODX info for everyone: http://bobsguides.com/modx.html
          My MODX Extras
          Bob's Guides is now hosted at A2 MODX Hosting
          • 2231
          • 10 Posts
          yes, Bob I think it is using Wayfinder , this is what I found in cache/siteCache.idx.php:

          $c[’top_menu_row’] = ’<LI><A class=root-item href="[+wf.link+]">[+wf.title+]</A></LI>’;

          However I cant find the "horizontal-multilevel-menu" , it must be in template/database ?

          stratton, I dont have access to manager panel, they said will email me the details tomorrow.

          So I guess to edit globally I need to login to manager? Currently I have only FTP access and cant figure it out.

          What about hidden div? Will I be able to add it globally? is HTML allowed to be added without any specific tags like Wayfinder has them?

          p.s: im just a bit pissed off, would never think that coding this task would be easier than integrating one bloody link with div tag + js, sorry if I was too harsh.

          thanks
            • 28042 ☆ A M B ☆
            • 24,524 Posts
            Wayfinder is in itself a minor application; it uses a number of mini-templates to control the output of the menu; the default is to generate a simple nested unordered list with several classnames depending on the parameters given in the snippet call. This allows the generation of any kind of menu that can be imagined. You might find this to be of interest. http://modxcms.com/forums/index.php/topic,34176.msg207851.html#msg207851

            What you have found in the cache file is the "row tpl", the mini-template to control the output for each row of the menu. It looks like it was done by someone who doesn’t know MODx or HTML very well; that should look like

            <li [+wf.classes+]><a class="root-item" href="[+wf.link+]">[+wf.title+]</a>[+wf.wrapper+]</li>


            The [+wf.classes+] placeholder will be replaced with whatever classes are specified in the snippet parameters; by default a class of "last" is applied to the last row of each level, and "active" is applied to the active menu item and its parents if the menu is nested in multiple levels. The menu as it is won’t allow styling of the active menu item, which is really the whole point of using a dynamically generated menu in the first place.

            The [+wf.wrapper+] placeholder will be where nested inner levels of the menu are inserted; without it you won’t get more than the top level of rows.

            It looks as if the outer set of <UL> tags are in the template itself, surrounding the [[Wayfinder...]] snippet tags. By default, Wayfinder uses a simple "outer tpl" to set the top-level <ul> tags, so another chunk should have been used for the "outer tpl".

            Since these mini-templates are usually stored in the database as "chunks", you’ll need access to the MODx Manager to edit them. However, it can also use external .php files to store the HTML code if you prefer; in that case the only parameter to the Wayfinder call would be the name of the configuration file to be used. You can find some sample config files in the assets/snippets/wayfinder/configs folder.

              Studying MODX in the desert - http://sottwell.com
              Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
              Join the Slack Community - http://modx.org
              • 3749
              • 24,544 Posts
              Without access to the MODX Manager, you’re pretty much dead in the water with MODX.

              Once there, you’ll want to look at the template and search it for a tag that says

              [[Wayfinder? . . . ]]

              If you don’t find it, look for a {{navchunk}} tag or something similar, which means that the Wayfinder tag has been put in a chunk (called navChunk) and you’ll have to look in the chunk to find the Wayfinder tag.

              In that Wayfinder tag, you should see &outerTpl=`something`.

              The "something" is the name of the chunk used to format the outer part of the Wayfinder menu. You should be able to add your menu choice near the end of it and have it show up in the Menu. You’ll have to do a "view source" on the menu to see what class is used to style each item and match that in your choice.

              There’s a bunch of information about Wayfinder here: http://muddydogpaws.com/development/wayfinder/features.html

              All of this, BTW, is second nature to anyone with even a little familiarity with MODX, and having Wayfinder automatically generate the perfect menu for you automatically when you add new pages to your site is definitely worth it. smiley
                Did I help you? Buy me a beer
                Get my Book: MODX:The Official Guide
                MODX info for everyone: http://bobsguides.com/modx.html
                My MODX Extras
                Bob's Guides is now hosted at A2 MODX Hosting
                • 2231
                • 10 Posts
                this is what I found in main template:

                <UL id=horizontal-multilevel-menu>
                [[Wayfinder? &startId=`0` &rowTpl=`top_menu_row` &titleOfLinks=`menutitle` &hereTpl=`top_menu_row_active`&activeParentRowTpl=`top_menu_row_active`]]
                </UL>


                But where the actual link names are coming from?? I mean home, about, partners, clients?

                There are many templates, one for main page, another for news, etc, does this mean I need to edit all of them to add a link in menu globally?
                  • 28042 ☆ A M B ☆
                  • 24,524 Posts
                  That extra set of <UL> tags is your problem. Try changing those to <div id=horizontal-multilevel-menu> and </div> tags instead. Wayfinder is providing its own enclosing <ul> and </ul> tags.

                  The menu items are taken from the Resource Tree, the list of resources you see in the left column. These are roughly analogous to pages; the titles, content, and other information specific to each page is managed here. The text is taken from the "menutitle" of each resource. Since the snippet has the parameter "startId=`0`" then it’s beginning by taking this information from the resources in the top level of the tree. Each level in the Tree is represented by a nested ul in the menu structure.

                  If you want to add a link in the main menu, add a resource in the appropriate level of the Resource Tree. These can be ordered for the menu using the MenuIndex field of each resource. The Wayfinder snippet calls in the templates will automatically include the new resource.
                    Studying MODX in the desert - http://sottwell.com
                    Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                    Join the Slack Community - http://modx.org
                    • 2231
                    • 10 Posts
                    thanks, ok I added the link to the menu, but the ONLICK atrribute is not appearing, although I put it in and its there, why is that?

                    <LI><A class=root-item-selected href="whatever">Home</A></LI>
                    <LI><A class=root-item href="/about">aboutС</A></LI>
                    <LI><A class=root-item href="/clients">clients</A></LI>
                    <LI><A class=root-item href="/partners">partners</A></LI>
                    ..etc
                    <LI><A class=root-item href="javascript:void(null)">MY NEW LINK</A></LI>
                      • 28042 ☆ A M B ☆
                      • 24,524 Posts
                      Don’t know what you are trying to do. If it’s an onclick attribute, it has to be in the link attributes field, and you have to add the [+wf.attributes+] placeholder to the row tpl.
                        Studying MODX in the desert - http://sottwell.com
                        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                        Join the Slack Community - http://modx.org