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

    I have am Evo 1.0.8 site that I am working on, and I have a list of chunks to render within a page, for example {{chunk1}} , {{chunk2}}, {{chunk3}} and {{chunk4}}. Now, the contents of these chunks are template variables, and not all of the template variables are completed in some instances - in these instances I need to be able to evaluate to see if the TVs are complete and if so render the corresponding chunk, if they are empty then I do not want the chunk rendered. I have a checkbox TV to state whether the {{chunk}} should be rendered - but not sure on how to get it to render logically...

    So..

    If Chunk1Checkbox = "ON" > then render {{chunk1}} on screen
    If Chunk2Checkbox = "ON" > then render {{chunk2}} on screen
    If Chunk3Checkbox = "" > then do not render {{chunk3}} on screen
    If Chunk4Checkbox = "" > then do not render {{chunk4}} on screen

    Is this possible? If so how? I can't get my head around it...

    Appreciate any insight / tips!



    Thanks!
      • 4172
      • 5,888 Posts
      you can try to use one checkbox-group with input-options:

      Chunk1=={{chunk1}}||Chunk2=={{chunk2}}||Chunk3=={{chunk3}}||Chunk4=={{chunk4}}


      then you need to put just this one TV into your template
        -------------------------------

        you can buy me a beer, if you like MIGX

        http://webcmsolutions.de/migx.html

        Thanks!
        • 8168
        • 1,118 Posts
        Quote from: Bruno17 at Jun 07, 2013, 08:03 PM
        you can try to use one checkbox-group with input-options:

        Chunk1=={{chunk1}}||Chunk2=={{chunk2}}||Chunk3=={{chunk3}}||Chunk4=={{chunk4}}


        then you need to put just this one TV into your template

        Thanks Bruno good plan. Another question...

        I have x4 TVs already in use (as checkboxes) called Chunk1Small, Chunk2Small, Chunk3Small and Chunk4Small - these use the checkbox-group method as above, what I'd like to do is then render or not render Chunk1 based on the tick or no tick of Chunk1Small etc... is that possible?
        • [[+Chunk1Small:empty=``:notempty=`[[+Chumnk1Small]]`]]


          There are a bunch of ways to do it.
            Get your copy of MODX Revolution Building the Web Your Way http://www.sanitypress.com/books/modx-revolution-building-the-web-your-way.html

            Check out my MODX || xPDO resources here: http://www.shawnwilkerson.com
            • 8168
            • 1,118 Posts
            Quote from: wshawn at Jun 10, 2013, 09:57 PM
            [[+Chunk1Small:empty=``:notempty=`[[+Chumnk1Small]]`]]


            Thanks wshawn, could you explain how this works in basic format - the code logic does not make much sense to me....?

            Also - will this method work on Evo (1.0.8)? [ed. note: dubbs last edited this post 10 years, 10 months ago.]
              • 36926
              • 701 Posts
              Quote from: dubbs at Jun 11, 2013, 11:12 AM

              Also - will this method work on Evo (1.0.8)?
              It won't work in Evo, but you can do the same thing with PHx.:
              http://wiki.modxcms.com/index.php/PHx/CustomModifiers#phx:ifnotempty
              • I totally missed your using Evo.
                  Get your copy of MODX Revolution Building the Web Your Way http://www.sanitypress.com/books/modx-revolution-building-the-web-your-way.html

                  Check out my MODX || xPDO resources here: http://www.shawnwilkerson.com
                  • 8168
                  • 1,118 Posts
                  @bennyb - Thanks, I will have a look at that
                  @wshawn - No probs - thought that looked like a revo call smiley