Download the PHP package devgroup/yii2-metronic without Composer
On this page you can find all versions of the php package devgroup/yii2-metronic. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package yii2-metronic
yii2-metronic
Yii2 Metronic theme integration. Currently is supported the version 4.6
Installation
The extension is in development and the only way to use this fork is through through composer.
So add it to your composer.json with this composer command:
Then You've to unzip the contents of your metronic Zip theme inside the folder. Check Aliases.
You should have a folder structure like this:
- app/
- web/
- metronic/
- _documentation
- _resources
- _start
- theme
- theme_rtl
- metronic/
- web/
Quick Start
Edit your configuration file and add the metronic component:
WARNING Check the "resources" key. This component field is used to locate the content of the zip theme. The component try to create a symlink to this directory inside it's folder. Eventually this may not work! In the case the link is invalid, you've to build it by yourself :)
My vendor folder looks like this:
- app/
- [...]
- vendor/
- dlds/
- yii2-metronic/
- assets -> symlink to /var/www/project/web/metronic/assets/theme/assets
- builders/
- bundles/
- helpers/
- layouts/
- widgets/
- yii2-metronic/
- dlds/
I suggest also to configure the assetManager. My actual configuration is this:
In the ThemeAsset class i've added the support for addons. You can specify additional css/js for specific controller/action.
In the example is visible the way to add login-4.min.css and jquery.backstretch.min.js to the login page (in my case, the actionLogin is managed by a controller named DefaultController).
Configuring the layout for your views is the last step.
The metronic component contains a sample layout view. I've not checked it. I'm working on my layout :)
Here is my sample :
Metronic theme require that you replace yii\helpers\Html with it's helper. So, you have to add a with the following content:
The file bootstrap.php should be loaded before the web application is created. So you need to edit your file and adjust it, and add a require directive. The file content should look like this:
Things to notice:
- I've moved the rendering of the main parts to separate files (parts/*). You can build this files and add them to your project.
- I pass everywhere the $directoryAsset variable: this contain the path to the assets. Useful to load images bundled with the metronic theme.
- the BODY tag is managed with a Layout::getHtmlOptions(). This method is able to build all the Metronic required classes.
- Always check to use $this->beginPage(), $this->beginBody() and relatives $this->endBody() and $this->endPage() in the proper places :)