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

    I'm puzzled on how to create a navigation list in a sidebar panel for a long resource. I have several long resources with several sections, each section being titled with the <h4> tag. To provide a link to each section I have added an anchor tag <a name="section 1" etc.

    What I'm trying to do is to generate a list of the anchor tags in a navigation panel to the side. I have searched but I can't find any extras that will provide this list.

    Any suggestions or avenues to pursue would be appreciated.

    Thanks

    Adrian
      • 42562
      • 1,145 Posts
      Searching and listing section tags or ids is work for the client side, I think...no need to get MODx power to do it from within, if that's what you are asking.

      I reckon you need a TOC plugin. jQuery or plain JavaScript can do that easily when the page is loaded.
      Check out http://projects.jga.me/toc/

      or even better, http://css-tricks.com/automatic-table-of-contents/

      And you won't need needless anchor tags for the sections, as long as you have the headings or a pattern, the plugin will inject the anchors for ya.....put the browser to work! - that's what I say.

      I hope that helps,
      Blessed New Year
        TinymceWrapper: Complete back/frontend content solution.
        Harden your MODX site by passwording your three main folders: core, manager, connectors and renaming your assets (thank me later!)
        5 ways to sniff / hack your own sites; even with renamed/hidden folders, burst them all up, to see how secure you are not.
        • 34049
        • 28 Posts
        Hi,

        Thanks for the response, you're correct it is a table of contents that I was after, now you mention it I can't think why I didn't just simply ask for a TOC.

        Thanks for the pointers I will follow them up.
          • 4172
          • 5,888 Posts
          you could also use MIGX to create the sections and the anchor-navigation easily
            -------------------------------

            you can buy me a beer, if you like MIGX

            http://webcmsolutions.de/migx.html

            Thanks!
          • Or ContentBlocks.

            You don't need named <a> anchors, you can use ID attributes as the anchors.
              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