We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 25803 ☆ A M B ☆
    • 721 Posts
    Hello,

    We are working on a Foundation 4 based system in MODX that has a lot of variables. For example, we want the user to be able to choose either the Orbit slider or NivoSlider and within each, the ability to set things like transition, transition speed, etc. Another example is the ability to change the number of calls to action on a home page from 2, 3, 4, 6, 8.

    As we see it there are 3 strategies for this:


    1. Create an Admin Resource
      Tie it to an Admin Template and tie a lot of Template Variables (in various categories) to that template.
      Get the values of the TVs by using:

      [[getResourceField? &id=`xx` &field=`whatever`]]

      Or MIGX by document ID when appropriate.
      Use conditionals with methods like:

      • The more efficient element modifier method:

        [[[[[[getResourceField? &id=`xx`&field=`whatever`]]:is=`something`:then=`$somechunk`]]]]

      • Using the If snippet when the element modifier method doesn't work
      • Using the Switch snippet when multiple possibilities exist

      Issues include:

      • Performance
      • Interface Complexity (but using Forms Customization and an appropriate ACL the user would only see the TV tab for this Admin Resource)
      • What else?
    2. Use ClientConfig
      Use the same set of conditional methods.

      Issues include:

      • Not (yet) Context sensitive (which basically kills this method at this point)
      • Doesn't (yet) support various TV type fields such as Rich Text
      • What else?
    3. Context Settings
      Similar to ClientConfig but without a nice interface but being, obviously, context sensitive.

      Issues include:

      • Doesn't (yet) support various TV type fields such as Rich Text
      • What else?

    Has anyone used other methods are have better ways for these methods?
      • 3749
      • 24,544 Posts
      I think I would go with System Settings and Context Settings (which will override the System Settings for that Context).

      For example:

      [[$[[++setting_name]]]]


      to pull in the chunk named in the setting.

      If speed is critical, you could also put the chunk code *in* the setting (setting values are "text" fields with room for about 64K of data) rather than in a chunk, then it would just be:

      [[++setting_name]]


      This avoids MODX having to retrieve the chunk but it makes editing more difficult. You could solve that by creating a CMP or front-end form for editing the System Settings.

        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