Announcement

Collapse
No announcement yet.

Conditional Help

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

  • Conditional Help

    In html type templates, I guess this is the best way?

    Code:
    <if condition="!in_array($bbuserinfo['userid'], array(1, 4))"> do stuff </if>
    In something like phpinclude_start is this the only way?
    PHP Code:
    if ($bbuserinfo['userid'] != 1) OR ($bbuserinfo['userid'] != 4)
    {
        do 
    stuff

    or can they be combined?
    if so, does it make any difference if they are combined...performance wise?

    thanks!

  • #2
    Programming note:

    You CANNOT use OR with a NOT condition, since it will ALWAYS be true. You must use AND.

    Comment


    • #3
      so then this would be correct i presume...

      PHP Code:
      if ($bbuserinfo['userid'] != 1) AND ($bbuserinfo['userid'] != 4)
      {
          do 
      stuff

      but actually, i think my example is wrongs because something stopped working under it
      notice i forgot to enclose the ifs in another ( )
      PHP Code:
      if (($bbuserinfo['userid'] != 1) AND ($bbuserinfo['userid'] != 4))
      {
          do 
      stuff

      anyways, is there something like the array thing to combine them and does it make any performance difference in doing so?

      Comment


      • #4
        Actually, I think you need to use the inarray syntax on multiple values.

        Comment

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