2017 © Pedro Pelรกez
 

library laravel-theme

Simple theme manager for Laravel 4.

image

bigecko/laravel-theme

Simple theme manager for Laravel 4.

  • Thursday, May 29, 2014
  • by harryxu
  • Repository
  • 7 Watchers
  • 32 Stars
  • 6,316 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 7 Forks
  • 2 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Simple theme support for Laravel 4

Inspired by lightgear/theme, but not depend on specific asset manager., (*1)

Install

Composer require:, (*2)

"bigecko/laravel-theme": "dev-master"

Service provider:, (*3)

'Bigecko\LaravelTheme\LaravelThemeServiceProvider',

Alias:, (*4)

'Theme' => 'Bigecko\LaravelTheme\Facade',

Usage

Structure

โ”œโ”€โ”€ public/
    โ””โ”€โ”€ themes/
     ย ย  โ”œโ”€โ”€ mytheme/
        |   โ”œโ”€โ”€ js/
        |   โ”œโ”€โ”€ css/
     ย ย  |   โ””โ”€โ”€ views/
        |
     ย ย  โ””โ”€โ”€ anothertheme/

Create a new folder public/themes., (*5)

Create a folder in themes use your theme name, like mytheme., (*6)

Put your theme templates file to mytheme/views., (*7)

init theme

Theme::init('mytheme');

custom path

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

Code example


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

Why use this?

Simple:, (*10)

  • Dot not need change code to render template, still View::make.
  • No asset management or other dependencies.
  • No new config file.
  • Just few lines of code, easy to read.
  • Only for theme, no more other responsibilities.

TODO

  • Add unit testing.

The Versions

29/05 2014

dev-master

9999999-dev

Simple theme manager for Laravel 4.

  Sources   Download

MIT

The Requires

 

by Avatar harryxu