XF 2.0 Detecting a template inside a macro

Nuno

Well-known member
Hi

Can we detect a template inside a macro?
I'm trying a template modification in xfmg_media_view_macros only if inside thread_view template:

Code:
<xf:if is="$template == 'thread_view'">
   .. do something ...
</xf:if>

Thanks
 
Normally, a macro only has access to the variables specifically passed in or the "default" template parameters (which is basically $xf ). In this case, the template isn't normally in $template, it's in {$xf.reply.template} so that should still work.

Macros do keep access to the current set of global variables within the $__globals container, though you shouldn't need that here.
 
Back
Top Bottom