We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 15921
    • 8 Posts
    What’s the ModX way to do this? I’m using Revo 2.1.2-pl

    I’m creating a directory which has multiple levels of listings. The basic, advanced, and premium levels of service each offer increasingly more information to the directory listing. I will store each directory entry as a child resource of a resource I am calling "Directory Entries".

    I see two ways to accomplish what I want:

    A. Create a master template called "Directory Entry" which contains TVs for all listing levels, then create an additional TV as a switch to select which listing level to use. Write a snippet to visit each resource and output HTML using the correct snippet for each level.

    B. Create one template for each directory listing level (basic, advanced, premium) which outputs the HTML for each level. Write a snippet to visit each resource and get the rendered HTML for each resource.

    Method B seems to be the most desirable to me: besides being easier to use, it also means I would be able to add new listing types by just adding a new template type and without having to modify the snippet. But I have a few questions about this:

    1. Have a missed an easier, more obvious method of doing this?

    2. Which method is the most ModX-like? I don’t know enough about the internal mechanisms of ModX to see any potential performance differences between the two. Would method A be significantly faster/slower than B due to caching mechanisms, etc.?

    Thanks for listening,
    Jay
      • 15921
      • 8 Posts
      In response to my own post, I did find another way to solve my problem that I like even better. Using the http://modx.com/extras/package/migx extra. I set up multiple tab sets using migx’s ability to switch on the fly and use unique templates for each. It was easy and good, and I can’t imagine the performance being any worse than the previous methods I mentioned. Thanks Bruno17!