if...else

Support MB Views if...else

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #47861
    369cycle369cycle
    Participant

    If I want to determine if the value of the user.member_level.value field is equal to doctor, how should I write it correctly?

    {% if user.member_level.value=doctor %}
     I am a doctor member
    {% else %}
     I am not a medical member
    {% endif %}
    #47879
    PeterPeter
    Moderator

    Hello,

    To compare the value, please use the operator ==

    {% if user.member_level.value == doctor %}

    You can read more about Twig operators in the documentation https://www.branchcms.com/learn/docs/developer/twig/operators

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.