We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 10076
    • 1,024 Posts
    I am trying to enable or disable social link for the whole site through the usage of an If statement and TV s. However the TV s need to be assigned to a template and then filled out per page. Meaning that on every page someone would need to choose to have a FB link or not. I m trying to create a TV for every social link tht contains user login, and if empy then don t display the FB link etc etc

    [[If? &subject=`[[*facebookusername]]` &operator=`notempty` &then=`<p>[[$showfacebookchunk]]</p>`]]


    So question how to make it so that one only fills out the username and the link appears on the website?
      • 10208 ☆ A M B ☆
      • 1,780 Posts
      I'm not sure you need If to do this.

      Try:

      [[*facebookusername:isnot=``:then=`<p>[[$showfacebookchunk]]</p>`]]


      You could use If with a radio button TV set to
      yes==yes||no==no
      as well, depending on the necessity of the username part. Like this:

      [[If? &subject=`[[*yes_noTV]]` &operator=`EQ` &operand=`yes` &then=`<p>[[$showfacebookchunk]]</p>`]]


      You could also use Switch to select single different social chunks. Make a radio button TV with:
      facebook==facebook||twitter==twitter||other==other

      chunks for the markup for each kind you'd like to include, and a chunk calling the TV placeholder
      [[+whichSocialLink]]


      Then use Switch like this:

       [[switch?
        &get=`[[getResources? &resources =`[[*id]]` &tpl=`socialLinksTpl` &includeTVs=`1` &processTVs=`1` &tvPrefix=`` &parents=`-1`]]`
        &c1=`facebook` &do1=`
        <div>
           [[$showFacebookChunk]]
          </div>`
        &c2=`twitter` &do2=`
        <div>
            [[$showTwitterChunk]]
          </div>`
        &c3=`other` &do3=`
        <div>
            [[$showAnotherChunk]]
          </div>`
      ]]

        Frogabog- MODX Websites in Portland Oregon
        "Do yourself a favor and get a copy of "MODX - The Official Guide" by Bob Ray. Read it.
        Having server issues? These guys have MODX Hosting perfected - SkyToaster