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

Force Style for Specific Route Prefix

Discussion in 'XenForo Development Discussions' started by Deek, Sep 8, 2014.

  1. Deek

    Deek Member

    I'm working on setting up a developer's area on our forums. I'd like for anything that matches the route prefix I created to use a specific theme that is different from the site's default theme. I don't want to allow users to have any choice in select thing style. Any suggestions on how to do this?
     
  2. Chris D

    Chris D XenForo Developer Staff Member

    You would do this from the Controller that is used by the Route rather than the Route directly.

    Just add this to the preDispatch in your controller:
    PHP:
    $this->setViewStateChange('styleId'9999);
    Replace 9999 with the correct style ID.

    You can, of course, surround that with other conditions, e.g. user group.
     
    Deek likes this.
  3. Deek

    Deek Member

    That is exactly what I needed. Thanks!
     

Share This Page