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

Is this valid code?

Discussion in 'XenForo Development Discussions' started by Matthew Hawley, Aug 16, 2013.

  1. Matthew Hawley

    Matthew Hawley Well-Known Member

    Is this valid code, because it wont work.

    Code:
    <li title="<xen:if is="{$user.customFields.customUserTooltip}" />" class="Tooltip"><a href="{xen:link members, $user}" class="username{xen:if '!{$user.visible}', ' invisible'}{xen:if {$user.followed}, ' followed'}">{$user.username}</a><xen:if is="{$i} < {$onlineUsers.limit}">,</xen:if></li>
    If its not, how do I put a custom user field in there.
     
  2. Jaxel

    Jaxel Well-Known Member

    Code:
    <xen:if is="{$user.customFields.customUserTooltip}" />
    This doesn't do anything the /> at the end denotes the end of the IF... so you should remove that. Not to mention, I don't even see a reason for the IF in the first place... As for the rest, it may work, but its bad form to put brackets inside of brackets. Try this:
    Code:
    <li title="{$user.customFields.customUserTooltip}" class="Tooltip">
        <a href="{xen:link members, $user}" class="username{xen:if '!{$user.visible}', ' invisible'}{xen:if {$user.followed}, ' followed'}">{$user.username}</a>
            <xen:if is="{$i} < {$onlineUsers.limit}">,</xen:if>
    </li>
     
    Matthew Hawley likes this.
  3. Matthew Hawley

    Matthew Hawley Well-Known Member

    Didn't work.
     
  4. Jeremy

    Jeremy XenForo Moderator Staff Member

    The xen:if tag is not self closing so you need a closing tag. You need short hand use the function: {xen:if condition, true, false}.
     
  5. Matthew Hawley

    Matthew Hawley Well-Known Member

    I tried this, and it didn't work:

    Code:
    {xen:if condition, $user.customFields.customUserTooltip true}
     
  6. Nobita.Kun

    Nobita.Kun Well-Known Member

    PHP:
    {xen:if '{$user.customFields.customUserTooltip}', {$user.customFields.customUserTooltip}, ''}
    Should be that :)
     
  7. Matthew Hawley

    Matthew Hawley Well-Known Member

    Why are there two custom user fields?
     
  8. Nobita.Kun

    Nobita.Kun Well-Known Member

    Code:
    {xen:if $conditions, $value_if_condition_is_true, $value_if_condition_false}
     
  9. Matthew Hawley

    Matthew Hawley Well-Known Member

    Well your code doesn't work.
     
  10. Nobita.Kun

    Nobita.Kun Well-Known Member

    What error you got? Post all code you have :)
     
  11. Matthew Hawley

    Matthew Hawley Well-Known Member

    There is no error, just the code doesnt work

    Code:
    <li title="{xen:if '{$user.customFields.customUserTooltip}', {$user.customFields.customUserTooltip}, '{$user.customFields.customUserTooltip}'}" class="Tooltip">
        <a href="{xen:link members, $user}" class="username{xen:if '!{$user.visible}', ' invisible'}{xen:if {$user.followed}, ' followed'}">{$user.username}</a>
            <xen:if is="{$i} < {$onlineUsers.limit}">,</xen:if>
    </li>
     
  12. Nobita.Kun

    Nobita.Kun Well-Known Member

    Code:
    <li title="{xen:if '{$user.customFields.customUserTooltip}', {$user.customFields.customUserTooltip}, ''}" class="Tooltip">
        <a href="{xen:link members, $user}" class="username{xen:if '!{$user.visible}', ' invisible'}{xen:if {$user.followed}, ' followed'}">{$user.username}</a>
            <xen:if is="{$i} < {$onlineUsers.limit}">,</xen:if>
    </li>
    Try it :D
     
  13. Matthew Hawley

    Matthew Hawley Well-Known Member

    Nope.
     
  14. Nobita.Kun

    Nobita.Kun Well-Known Member

    {xen:helper dump, $user.customFields.customUserTooltip} what result for?
     
  15. Matthew Hawley

    Matthew Hawley Well-Known Member

    I already got it, but thanks.
     

Share This Page