[RSS Feed/News] How to check a variable using a conditional? (XF Template)

Status
Not open for further replies.

XenForo

Administrative
  • Thread starter
  • Admin
  • #1
I can't believe this has never been asked before, but anyway, here is my code so far.

HTML:

Code:
<xf:set var="$number">
    {{ rand(1,3) }}
</xf:set>
<xf:if is="{$number} == 1">
    <a href="URL"><img src="image URL"></a>
<xf:else />
    <p>{$number}</p>
</xf:if>

The problem here is specifically this line:
Code:

<xf:if is="{$number} == 1">

If it is as above, it will always fire and display the image, no matter what the random number is. But if it is as below:
Code:

<xf:if...

Read more

ادامه مطلب...
 
Status
Not open for further replies.
Back
Top Bottom