1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Xenforo Expressions

Discussion in 'XenForo Questions and Support' started by =MGN=RedEagle, Jul 4, 2014.

  1. =MGN=RedEagle

    =MGN=RedEagle Well-Known Member

    Hi there,

    I am a PHP noob trying to learn how to customize Xenforo a little bit. I am playing around with what I think are expressions:

    $visitor['user_id'] > 0

    How can I find a list of such expressions?
     
  2. Brogan

    Brogan XenForo Moderator Staff Member

  3. =MGN=RedEagle

    =MGN=RedEagle Well-Known Member

    Aha! Yes, seems like what I am looking for. It seems BD widget framework leverages this. It has an area called "Expressions" and leaves a blank space. Then it gives the hint:


    Enter your expression here. Please use the correct PHP syntax and make sure you know 100% which variables are available in target position. For template position, all template parameters will be accessible but for hook position, only hook parameters will be accessible. Some common used expressions:

    $visitor['user_id'] > 0 -- means: show the widget for logged in users only.

    XenForo_Template_Helper_Core::callHelper('ismemberof', array($visitor,3)) -- means: show the widget for users of user group #3 only.


    Does Xenforo have a list of commonly used expressions?
     
  4. Brogan

    Brogan XenForo Moderator Staff Member

    Conditional statements are for use in HTML templates.
    The syntax is completely different from PHP.

    There is no commonly used list as PHP code isn't generally used outside of PHP files, by developers.
     
  5. =MGN=RedEagle

    =MGN=RedEagle Well-Known Member

    Is $visitor['user_id'] > 0 a conditional statement?
     
  6. Brogan

    Brogan XenForo Moderator Staff Member

    That is PHP, as the add-on states:
     
    =MGN=RedEagle likes this.

Share This Page