singrana/thememanager

Theme manager for Yii2 (simple theme managment for Yii2)

Installs: 436

Dependents: 0

Suggesters: 0

Security: 0

Stars: 1

Watchers: 2

Forks: 1

Open Issues: 0

Type:yii2-extension

dev-master 2016-03-11 09:08 UTC

This package is not auto-updated.

Last update: 2024-04-23 00:42:35 UTC


README

Theme manager for Yii2

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist singrana/thememanager "*"

or add

"singrana/thememanager": "*"

to the require section of your composer.json file.

Usage

Change your application config

'view'=>
[

	'theme'	=>
	[
			'class'     =>	'singrana\thememanager\components\ThemeManager',
			'current'	=>	'site',

			'themes'	=>
			[
				'site'	=>
				[
					'pathMap'	=>
					[
						'@app/views'	        =>	'@app/themes/site/views',
						'@app/views/layouts'	=>	'@app/themes/site/layouts',
					],
					'defaultLayout'				=>	'//inner',
				],

			...
			],
			...
	],
],

If you need to change theme, use:

\Yii::$app->view->theme->changeTheme('themeName');

For dynamic create new theme:

\Yii::$app->view->theme->createTheme('newTheme',
[
	'pathMap'			=>
	[
		'@app/views'			=>	'@app/themes/admin/views',
		'@app/views/layouts'	=>	'@app/themes/admin/layouts',
	],
]);

and use new theme:

\Yii::$app->view->theme->changeTheme('newTheme');