Announcement

Collapse
No announcement yet.

If condition with or

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

  • BirdOPrey5
    replied
    You may need to use the word OR instead of the || in the template... I always use OR or AND rather than || or &&

    Leave a comment:


  • gatsman
    replied
    The first condition:
    Code:
    <vb:if condition="$channel['nodeid'] != 16 || $channel['nodeid'] != 20">
    wont work but the array will do the trick.
    Thank you

    Leave a comment:


  • BirdOPrey5
    replied
    Code:
    <vb:if condition="$channel['nodeid'] != 16 || $channel['nodeid'] != 20">
    That's fine notation if you have 2 or even 3 numbers to check, but if you have many more it would get annoying. In that case you can use the in_array function.

    Code:
    <vb:if condition="!in_array($channel['nodeid'], array(16,20,24))">
    You can have as few as 1 element in the array and as many as you can type, so long as each is separated by a comma.

    The ! at the front of the statement means NOT... so if 16, 20, or 24 are NOT in the array, then do whatever it is you are going to do.

    For additional help on custom coding please go to www.vbulletin.org.

    Leave a comment:


  • gatsman
    started a topic If condition with or

    If condition with or

    I got an if like:
    Code:
      
     <vb:if condition="$channel['nodeid'] != 16">
    <tr><td>Something</td></tr>
    </vb:if>
    but i need it to also check for 20 so it must be something like:
    Code:
      
     if != 16 || 20
    how do i write that
widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
Working...
X