We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 51051
    • 1 Posts
    I am trying to build a page that gives an editor the ability to add an item to accordion content.

    My end goal is to make something like *see attachment* or lookup bootstrap-collapse or https://jqueryui.com/accordion/ , but also make it simple to where all the editor has to do is add the content to a new tv, and that would add a new item to the accordion..

    I hope I have made sense, and any thoughts or ideas would be great..

    TY in advance.
      • 44007
      • 15 Posts
      There are a couple of ways to peel this, and without going in to detail which you'll find in various other posts or RTFM pages:

      1. If you want to contain the content for your accordion to a single resource, use MIGx with a single TV that will allow you to add multiple 'rows' to your TV. Render this using chunks (tpl) that generate the require HTML structure for your accordion.

      2. If each row in your accordion can be considered a resource in its own right, hang these child resources off a parent page which contains a getResources call - again, rendering using chunks (tpl) that generate the required HTML structure.

      Which method you choose depends on the nature of the content in your accordion, how a content editor would expect it to be structured etc. [ed. note: wallacio last edited this post 11 years ago.]
        • 28042 ☆ A M B ☆
        • 24,524 Posts
        If there's likely to be a lot of these, and they each contain a lot of content, you can even use MIGXdb to create a grid TV like solution #1 above, but using a separate database table for the items.

        You can also use MIGXdb in a single TV to generate a grid based on resources. Functionality would be like #2 above, but the convenience of management would be the same as #1.

        MIGX comes with several snippets for the output of its grid TVs. Usually the getImageList snippet is sufficient.

          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