What is the variable for custom user fields? in XF1 it was
{$visitor.customFields.fieldname}
{$xf.visitor.Profile.custom_fields.fieldID}
The conditional statements can be expanded by using AND, OR conditional statements operators and using xf:if, xf:else, xf:elseif.
Is anyone successfully using xf:elseif statements? It's noted in the Resource description, but there are no examples and no one in the discussion has mentioned its use.
I'm getting errors when I try to implement.
<xf:if is="$alerts is not empty">
<ol class="listPlain">
<xf:foreach loop="$alerts" value="$alert">
<li data-alert-id="{$alert.alert_id}"
class="block-row block-row--separated{{ $alert.isUnviewed() ? ' block-row--highlighted' : ($alert.isRecentlyViewed() ? '' : ' block-row--alt') }}">
<xf:macro template="alert_macros" name="row" arg-alert="{$alert}" />
</li>
</xf:foreach>
</ol>
<xf:elseif is="$page <= 1" />
<div class="block-row">{{ phrase('you_do_not_have_any_recent_alerts') }}</div>
<xf:else />
<div class="block-row">{{ phrase('no_alerts_can_be_shown') }}</div>
</xf:if>
Thank you....helps to include the trailing slash :doh:<xf:elseif is="$page <= 1" />
I think will be there but need editing to the xf2 codeIf I upgrade from version 1.5 to 2.0 will the conditional statements I inserted into the templates disappear?
44. How do I hide content in multiple forums?
Code:<xf:if is="in_array($forum.node_id, [x,y,z])"> Hide content.. </xf:if>
Is there a way to hide a button I've made if the person who created the thread (I don't mean person viewing the thread, the person who created the thread), is already part of usergroup X?
<xf:if is="!$thread.User.isMemberOf(2)">
<xf:button href="{{ link('whats-new') }}" class="button--link">
I am not in the Registered user group
</xf:button>
</xf:if>
What conditional should I use to display content in a specific RM category? The example for forum categories doesn't work there.
<xf:if is="$resourceCategory.resource_category_id == 2">
Content in resource category 2
</xf:if>
Nice, thank you @smozgur
I accidentally stumbled onto this way... Is there a difference?
HTML:<xf:if is="$resource.resource_category_id == 9"> Show content.. </xf:if>
We use essential cookies to make this site work, and optional cookies to enhance your experience.