Package Data | |
---|---|
Maintainer Username: | harryxu |
Maintainer Contact: | harryzhxu@gmail.com (harryxu) |
Package Create Date: | 2014-01-05 |
Package Last Update: | 2014-05-29 |
Home Page: | |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2024-11-23 03:08:52 |
Package Statistics | |
---|---|
Total Downloads: | 6,687 |
Monthly Downloads: | 0 |
Daily Downloads: | 0 |
Total Stars: | 30 |
Total Watchers: | 8 |
Total Forks: | 6 |
Total Open Issues: | 2 |
Inspired by lightgear/theme, but not depend on specific asset manager.
Composer require:
"bigecko/laravel-theme": "dev-master"
Service provider:
'Bigecko\LaravelTheme\LaravelThemeServiceProvider',
Alias:
'Theme' => 'Bigecko\LaravelTheme\Facade',
├── public/
└── themes/
├── mytheme/
| ├── js/
| ├── css/
| └── views/
|
└── anothertheme/
Create a new folder public/themes
.
Create a folder in themes
use your theme name, like mytheme
.
Put your theme templates file to mytheme/views
.
Theme::init('mytheme');
Theme::init('mytheme', array(
'public_dirname' => 'allthemes', // Base dirname for contain all themes, relative to public path.
'views_path' => app_path('views'), // Change the path to contain theme templates.
));
Once you change the views_path, the sub dir views
for theme is not needed,
just create your theme folder in views_path, and put templates in it.
like: app/views/mytheme/hello.blade.php
.
View::make('home'); // First find in 'public/themes/mytheme/views/'.
// If file not exist, will use default location 'app/views/'.
Theme::asset('js/a.js'); // 'http://domain/themes/mytheme/js/a.js'
Theme::publicPath('js/jquery.js') // /path/to/project/public/themes/mytheme/js/jquery.js
Theme::name(); // Get current theme name.
Also support package templates overriding, just put package templates to your theme views folder.
Simple:
View::make
.