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

Style name checking in addon

#1
Greetings,

Is there a way to detect the style name variable (or id)? I have seen the {$visitorStyle.title} in a template but how am I going to get access to that property in the addon?

I am trying to use the template_hook to inject some HTML in my footer based on the style selected.

Thanks!
 
R

ragtek

Guest
#2
You can get the style id with the visitor object
PHP:
$visitor = XenForo_Visitor::getInstance();
$styleId = $visitor['style_id'];
 

Shadab

Well-known member
#4
Strictly, the counterpart to "{$visitorStyle.title}" in code would be:
PHP:
$params = $template->getParams();

// id stored in 'style_id'
$styleTitle = $params['visitorStyle']['title'];
(assuming you have named the 4th parameter as $template)

Although I haven't checked what's the difference between grabbing the style id from visitor object
and from the style information stored in "visitorStyle".