Announcement

Collapse
No announcement yet.

template conditionals

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • template conditionals

    Hi,

    With 3.8.x is it possible to do some sort if if {} conditional in a template for a custom profile field?


  • #2
    <if condition="userinfo['fieldX'] == 'XYZ'">do something</if>

    Though it will vary depending on page and what you want to do.
    Translations provided by Google.

    Wayne Luke
    The Rabid Badger - a vBulletin Cloud demonstration site.
    vBulletin 5 API

    Comment


    • #3
      There is a $ before the variable name, ie:
      HTML Code:
      <if condition="$userinfo['fieldX'] == 'XYZ'">do something</if>
      If you are doing it in a postbit template, you may want to use the $post variable:
      HTML Code:
      <if condition="$post['fieldX'] == 'XYZ'">do something</if>

      Please don't PM or VM me for support - I only help out in the threads.
      vBulletin Manual & vBulletin 4.0 Code Documentation (API)
      Want help modifying your vbulletin forum? Head on over to vbulletin.org
      If I post CSS and you don't know where it goes, throw it into the additional.css template.

      W3Schools &lt;- awesome site for html/css help

      Comment


      • #4
        I'm trying to use it in the header template.

        When I copy and paste what you gave me I get an error while trying to save the template. If I add a "$" infront of userinfo it doesn't give the error...however the conditional does not seem to work.

        My profile field is a single selection dropdown and I am using "1" for the first option, "2" for the second etc. (this is the value shown for each option in the Options page html source).


        edit: Lynne cleared up the syntax error for me while I was typing - however the fact that it doesn't work is still an issue. Should I try a different type of option?

        And yes, I did edit fieldX to field[num]

        Comment


        • #5
          Post up exactly what you did so we can see what the problem is.

          And, are you targeting the field of the user *viewing* the page? If so, then you need to use $bbuserinfo['fieldx'].

          Please don't PM or VM me for support - I only help out in the threads.
          vBulletin Manual & vBulletin 4.0 Code Documentation (API)
          Want help modifying your vbulletin forum? Head on over to vbulletin.org
          If I post CSS and you don't know where it goes, throw it into the additional.css template.

          W3Schools &lt;- awesome site for html/css help

          Comment


          • #6
            $bbuserinfo fixed it, thanks!

            Comment

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