Joomla 3.8 switching templates/styles?

161 Views Asked by At

Okay, so I understand that you can set a template/style in a menu item which I understand. However.. What would you do in this situation..

The website uses two different templates/styles depending on what section of the website they are in.

What if you are in section 1 of the website and need to go to section 2 that uses a different style? And this action is controlled by a controller on if a condition is met.

I've managed to do this so far using $app->redirect and including the Menu Id so that joomla picks up the correct template/style to use. However this just seems wrong, as I can't determine the Menu Id once the component is installed elsewhere...

Doing the getView() approach to show a certain view seems like the correct procedure, however it doesn't allow me to change the template/style and will use the template/style from the original menu item.

Is there another method I don't know about? Does Joomla simply not have something in place for this? It's almost as if I need to change getView to accept a template/style parameter

1

There are 1 best solutions below

0
Sjc311 On

They changed the name Template/Style to theme.

JFactory::getApplication()->set('theme', 'my_system');