2017 © Pedro Peláez
 

library view-themes

Provides support for themed views in Laravel.

image

alexwhitman/view-themes

Provides support for themed views in Laravel.

  • Saturday, June 14, 2014
  • by alexwhitman
  • Repository
  • 2 Watchers
  • 18 Stars
  • 612 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 4 Forks
  • 0 Open issues
  • 6 Versions
  • 0 % Grown

The README.md

Laravel View Themes

View themes is a simple package to provide themed view support to Laravel., (*1)

Installation

Add alexwhitman/view-themes to the require section of your composer.json file., (*2)

"alexwhitman/view-themes": "1.2.x", (*3)

Run composer update to install the latest version., (*4)

Setup

This package extends Laravels built in ViewServiceProvider, so that provider must be replaced in app/config/app.php. Replace the instance of 'Illuminate\View\ViewServiceProvider', with 'AlexWhitman\ViewThemes\ViewThemesServiceProvider',., (*5)

Configuration

The default settings are for the themes to be in a themes directory in app/ with the default theme called default., (*6)

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., (*7)

Usage

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 app/themes/my-theme/views. If the view is not found for the current theme the default theme will then be searched., (*8)

Facade

The ViewTheme facade can also be used if preferred ViewTheme::setCurrentTheme('my-theme') by adding an entry for AlexWhitman\ViewThemes\ThemeFacade to app/config/app.php., (*9)

Example

Given a directory structure of, (*10)

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

Changelog

1.2.0

  • Update for Laravel 4.2

1.1.2

  • Add function to get current theme path

1.1.1

  • Clear previous paths on initialise

1.1.0

  • Update for Laravel 4.1

1.0.0

  • Initial release

The Versions

14/06 2014

dev-master

9999999-dev http://github.com/alexwhitman/laravel-view-themes

Provides support for themed views in Laravel.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Alex Whitman

laravel themes view

14/06 2014

1.2.0

1.2.0.0 http://github.com/alexwhitman/laravel-view-themes

Provides support for themed views in Laravel.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Alex Whitman

laravel themes view

21/05 2014

1.1.2

1.1.2.0 http://github.com/alexwhitman/laravel-view-themes

Provides support for themed views in Laravel.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Alex Whitman

laravel themes view

15/05 2014

1.1.1

1.1.1.0 http://github.com/alexwhitman/laravel-view-themes

Provides support for themed views in Laravel.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Alex Whitman

laravel themes view

30/01 2014

1.1.0

1.1.0.0 http://github.com/alexwhitman/laravel-view-themes

Provides support for themed views in Laravel.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Alex Whitman

laravel themes view

10/10 2013

1.0.0

1.0.0.0 http://github.com/alexwhitman/laravel-view-themes

Provides support for themed views in Laravel.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Alex Whitman

laravel themes view