I have created new theme as Plugin following Cakephp 3.x documentation.
in my AppController i have condition to load different themes.
// Layouts
$this->viewBuilder()->setTheme('Legacy'); //default theme
if (!is_null($this->request->getParam('prefix'))) {
$prefix = explode('/', $this->request->getParam('prefix'))[0];
switch ($prefix) {
case 'c':
$this->viewBuilder()->setTheme('Campaign');
break;
case 'admin':
$this->viewBuilder()->setTheme('Admin');
break;
}
}
my default route for admin prefix is:
Router::prefix('admin', function ($routes) {
// All routes here will be prefixed with `/admin`
// And have the prefix => admin route element added.
$routes->connect('/', ['controller' => 'Users', 'action' => 'dashboard']);
$routes->fallbacks('InflectedRoute');
});
but when i got in browser to http://localhost:8180/admin/
i see only error:
Error: The view for UsersController::dashboard() was not found.
Confirm you have created the file: “Admin/Users/dashboard.ctp” in one of the following paths:
/var/www/myapp/src/Template/Admin/Users/dashboard.ctp
my dashboard.ctp is in the Plugin folder plugins/Admin/src/Template/Users/dashboard.ctp
am i doing something wrong here ?
should the theme views be placed in plugin folder as suggested in documentation or in
/var/www/myapp/src/Template/THEMENAME/ …