I
I
izac2016-08-18 22:32:47
Yii
izac, 2016-08-18 22:32:47

How to call frontend Yii:$app function from backend?

Good afternoon, I installed a plugin which is a theme manager for the front of the site, plugin .
The question is that to change the theme you need to call a function

\Yii::$app->view->theme->changeTheme('themeName');
, but when you try to call it from the backend controller, it says that there is no such function (it is clear for what reasons). And the logical question is brewing: how to call this frontend function from the backend part, where is it?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Maxim Timofeev, 2016-08-20
@izac

The fact is that backend and frontend are two different applications and when you do something in the backend, the frontend config is missing.
Therefore, I see several options:
1. Move the connection of this module to a separate file, which is overwritten
2. Insert variables from the database into the configuration, store them there
3. Make an action in the frontend and call it from the backend, will be able to manipulate with your module.

D
Dmitry, 2016-08-18
@slo_nik

Good evening.
You connected the plugin in what config? For the front end?
Connect to common.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question