XF 2.0 Can you show/hide content on multiple templates?

limboclub

Active member
One of our ad units shows only in certain templates.

This if statement just isn't working, however:

Code:
<xf:if is="in_array({$template}, ['category_view','search_form_post','search_form_profile','search_results'])">
code
</xf:if>

It is wrapped around code in an Advertisement in the ads system.

Where might I be going wrong here?
 
The available variables are always contextual, though I can guarantee that there won't generally be a $template variable like that. You can use this code to get a list of variables exposed to a template:
Code:
{{ dump(vars()) }}
At a guess, {$xf.reply.template} probably contains the value you want now.
 
The available variables are always contextual, though I can guarantee that there won't generally be a $template variable like that. You can use this code to get a list of variables exposed to a template:
Code:
{{ dump(vars()) }}
At a guess, {$xf.reply.template} probably contains the value you want now.
OK now to set aside a day to learn how to decipher the dump output.

You really need a Wiki.
 
Back
Top Bottom