XF 2.0 Building pages with widgets - does it need an addon to access variables?


Well-known member
If I understand correctly, the notable members page is basically a template with widgets, right?

Is there a code behind the scenes somewhere that passes the variables it needs to it or are they available globally? i.e. to replicate something similar to this would it require a new addon or just a new template?

What I mean is say for this

<xf:foreach loop="{$resultsData.{$active.member_stat_key}}" key="$userId" value="$data">
                        <li class="block-row block-row--separated">
                            <xf:macro template="member_list_macros" name="item"
                                arg-extraDataBig="{{ true }}" />
                    <xf:else />
Are variables like $resultsData and $data.value available to all templates or would this code only work in this specific template?

Hope that question makes sense!


XenForo developer
Staff member
Technically, some of the stuff in the sidenav on that page are widgets, though none of the main content is. There is a widget to display a particular member stat though (see the "most resources" block on the resource overview page).

Chris D

XenForo developer
Staff member
Ah no we just made member stats available as widgets because it was pretty much equivalent to some separate code we used to create in some cases for things like the RM and MG index page side nav (Most media items etc.).