• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

accessing simpleCache from templates

tenants

Well-known member
#1
For sessions, there is no need to added anything to the controller/model/view since the session can be accessed from a template as:

{$session.x}

for example:
Code:
<xen:if is="!{$session.robotId}">
   Xenforo has not detected me as a crawler
</xen:if>
Is there something similar for simpleCache (since its globally fetched and requires 0 query overhead)
Or do I have to push something in the controller every time I need to access simpleCache in a template ?
 

Chris D

XenForo developer
Staff member
#2
Yes:
Code:
{$xenCache.key}
e.g.

Code:
<xen:if is="{$xenCache.userUpgradeCount}"><li><a
    class="{xen:if "{$selectedKey} == 'account/upgrades'", 'secondaryContent', 'primaryContent'}"
    href="{xen:link account/upgrades}">{xen:phrase account_upgrades}</a></li></xen:if>
 

Chris D

XenForo developer
Staff member
#4
Incidentally you can see default template params by going to:
XenForo_Dependencies_Abstract::preRenderView();

They will apply to public and admin templates.

Then there's some Admin/Install/Public specific ones too.