We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 30491
    • 44 Posts
    thanks Benmarte I really appreciate the input, I guess my assumption was that Template 2 should not even render the TV since it doesn't have access to it...now with this in mind, I am struggling to find a way that allow me to differentiate between the 'default' value of a TV (for Templates that have access to that TV) and the default value assigned by templates that don't have access.

    I could only think of three solutions to this:


    1. No default value, and then simply manually adjust the TV for each resource (with over 2000 resources, this is definitely not feasible)
    2. A plugin/snippet that allows default values for a TV to be set for each template, and so any resource created with that template would automatically have that TV value filled in accordingly. (This sounds like it might do the job, but it's quite an elaborate solution)
    3. A snippet that cross-checks the TV against the template of the resource in question, and if that template has access to that TV, then it will let MODX continue parsing it, if not, it will simply return empty. (I think this might work,and perhaps I've already got some of that code handy (in the first post))

      • 3109 ☆ A M B ☆
      • 894 Posts
      Try using an output modifier on the template something like this:
      [[*template:eq=`1`:then=`[[*createPDF]]`]]
      


      You can get the template ID by going to the templates resource tree in the Elements tab or by clicking on the template field and it should be displayed between the ().

      Let me know if that works, good luck.
        Benjamin Marte
        Interactive Media Developer
        Follow Me on Twitter | Visit my site | Learn MODX
        • 30491
        • 44 Posts
        Hi Benmarte,

        Thanks a lot you've really helped me get out of this confusion smiley the workaround I've found is using the 'IF' addon and checking it against the template id as you've suggested smiley It's working fine.

        [[If?
           &subject=`[[*template]]`
           &operator=`inarray`
           &operand=`1,2,7`
           &then=`[[*createPDF]]`
           &else=`No PDF`
        ]]
        


        Thanks alot smiley
          • 3109 ☆ A M B ☆
          • 894 Posts
          Glad you got it working.
            Benjamin Marte
            Interactive Media Developer
            Follow Me on Twitter | Visit my site | Learn MODX