Conditional Template

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Hamma
    Senior Member
    • Aug 2001
    • 144
    • 3.6.x

    Conditional Template

    Is it possible to do something like <if usergroupid=XX> </if> ?

    Or even better <if usergroupid=XX or XX or XX> </if>
  • M1th
    Senior Member
    • Jul 2003
    • 527
    • 3.6.x

    #2
    nope.. you can only use the conditionals in vB3. Unless you want to hack them into vb2 yourself.
    Chamber of Secrets - The Ultimate Harry Potter Community!

    Comment

    • Hamma
      Senior Member
      • Aug 2001
      • 144
      • 3.6.x

      #3
      Thats why I posted in the vb3 forum heheh

      Comment

      • Toliman
        Senior Member
        • Dec 2000
        • 101

        #4
        sure thing

        <if condition="$bbuserinfo[usergroupid] == whateverGroup">

        your template here

        </if>

        Comment

        • Hamma
          Senior Member
          • Aug 2001
          • 144
          • 3.6.x

          #5
          Very nice

          However, if I did usergroupid == 1,5,3 would that work?

          Comment

          • tubedogg
            Senior Member
            • Feb 2001
            • 13602

            #6
            No. The conditional has to be valid PHP.

            Comment

            • iDavid
              Senior Member
              • Dec 2002
              • 298

              #7
              ...And, since not everybody in the world knows PHP, I'll actually help you -- try this:

              Code:
              <if condition="$bbuserinfo[usergroupid] == 1 || $bbuserinfo[usergroupid] == 3 || $bbuserinfo[usergroupid] == 5">
               
              <!-- Do something -->
               
              </if>
              I don't remember whether "or" or "||" is used in the templates, but either should work.

              Comment

              • Toliman
                Senior Member
                • Dec 2000
                • 101

                #8
                Originally posted by iDavid
                ...And, since not everybody in the world knows PHP, I'll actually help you -- try this:

                Code:
                <if condition="$bbuserinfo[usergroupid] == 1 || $bbuserinfo[usergroupid] == 3 || $bbuserinfo[usergroupid] == 5">
                 
                <!-- Do something -->
                 
                </if>
                I don't remember whether "or" or "||" is used in the templates, but either should work.
                It doesn't matter, in php you can use ||, or so I think in the templates you can use ||, or also

                The devs seem to use "and, or" but I have some templates written with "&&, ||" and that's not a problem

                Comment

                • Hamma
                  Senior Member
                  • Aug 2001
                  • 144
                  • 3.6.x

                  #9
                  Thanks

                  Comment

                  widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
                  Working...