1. 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

Discussion in 'XenForo Development Discussions' started by niden.net, Mar 8, 2011.

  1. niden.net

    niden.net Member


    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.

  2. ragtek

    ragtek Guest

    You can get the style id with the visitor object
    $visitor XenForo_Visitor::getInstance();
    $styleId $visitor['style_id'];
    niden.net likes this.
  3. niden.net

    niden.net Member

    Thank you Sir!
  4. Shadab

    Shadab Well-Known Member

    Strictly, the counterpart to "{$visitorStyle.title}" in code would be:
    $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".
    niden.net likes this.

Share This Page