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

Getting a template error due to bad syntax

Discussion in 'Styling and Customization Questions' started by Luxus, Jan 25, 2013.

  1. Luxus

    Luxus Well-Known Member

    I have this in my template:

     <xen:if is="{$user.message_count} > 29 AND < 100">content</xen:if>
    This means if a user has more than 29 posts but less than 100, then content should be shown. But if I attempt to save the template I get a template error. TMS doesn't say what error, but says the server doesn't respond, which from experience means that something isn't right with my code. I also tried this:

     <xen:if is="{$user.message_count} > 29 < 100">content</xen:if>
    but this produces a parse error which messes up my template. Can anyone please show me how it's done right?
  2. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    <xen:if is="{$user.message_count} > 29 AND {$user.message_count} < 100">content</xen:if>
    Luxus likes this.
  3. Luxus

    Luxus Well-Known Member

    It works, thank you very much (y)

    hm.. I was just thinking isn't it possible to use an array or something? Like

    <xen:if is="in_array({$user.message_count}, array(30 - 99)">
  4. James

    James Well-Known Member

    No, because in array will require you to have all possible integers from 29 to 100 for it to work.

    It'd be nice if we could do: 29 < $user.message_count < 100

    ... But we can't :(

Share This Page