Provides support for themed views in Laravel.
View themes is a simple package to provide themed view support to Laravel.
alexwhitman/view-themes to the
require section of your
composer update to install the latest version.
This package extends Laravels built in
ViewServiceProvider, so that provider must be replaced in
Replace the instance of
The default settings are for the themes to be in a
themes directory in
app/ with the default theme called
app/ themes/ default/ views/
To change these defaults the package config will need to be published with
artisan config:publish alexwhitman/view-themes.
The new config file,
app/config/packages/alexwhitman/view-themes/config.php, can then be customised as required.
A standard call to
View::make('index') will look for an index view in
app/themes/default/views/. However, if a theme is specified with
$app['view.finder']->setCurrentTheme('my-theme'); prior to calling
View::make() then the view will first be looked for in
If the view is not found for the current theme the default theme will then be searched.
ViewTheme facade can also be used if preferred
ViewTheme::setCurrentTheme('my-theme') by adding an entry for
Given a directory structure of
app/ themes/ default/ views/ layout.blade.php admin.blade.php my-theme/ views/ layout.blade.php
View::make('layout'); // Loads app/themes/default/views/layout.blade.php $app['view.finder']->setCurrentTheme('my-theme'); View::make('layout'); // Loads app/themes/my-theme/views/layout.blade.php View::make('admin'); // Loads app/themes/default/views/layout.blade.php
- Update for Laravel 4.2
- Add function to get current theme path
- Clear previous paths on initialise
- Update for Laravel 4.1
- Initial release