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

XF 1.5 Using conditionals in custom user field

Discussion in 'XenForo Questions and Support' started by NinaMcI, May 3, 2016.

  1. NinaMcI

    NinaMcI Active Member

    Hi,
    I'm trying to figure out how I can have different link outputs depending on the text input of a custom user field.
    This is what I've tried, but withou any success.

    Code:
    <xen:if is="{$value}=='coursera'"><a href="https://www.coursera.org/about/">{$value}</a>
    <xen:elseif is="{$value}=='OpenLearn by The Open University'"><a href="http://www.open.edu/openlearn/">{$value}</a>
    <xen:else />
    </xen:if>
    Basically, if the text input in the custom field is "Coursera", I want the output to link to Coursera URL or if the input text in the custom field is "OpenLearn by The Open University", I want the output to link to OpenLearn URL

    Any suggestions would be very much appreciated :)
     
  2. Mike

    Mike XenForo Developer Staff Member

    Is this in the value display HTML? That doesn't support template conditions. You can only use something along this line directly in the template. (The variables would be a bit different and context dependent.)
     
  3. NinaMcI

    NinaMcI Active Member

    Oh right. OK, thanks.
     

Share This Page