2017 © Pedro Peláez
 

library zf-themes

Theme system for ZF2

image

shadowfax/zf-themes

Theme system for ZF2

  • Thursday, September 5, 2013
  • by shadowfax
  • Repository
  • 2 Watchers
  • 3 Stars
  • 6 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

ZF-Themes

Zend Framework 2 (ZF2) theme manager, (*1)

Add the following line to composer.json of your application, (*2)

"require": {
    "shadowfax/zf-themes": "dev-master"
}

In the index.php change, (*3)

Zend\Mvc\Application::init(require 'config/application.config.php')->run();

with, (*4)

Themes\Mvc\Application::init(require 'config/application.config.php')->run();

This will load the ThemeManager service., (*5)

When creating a new module simply implement Themes\ModuleManager\Feature\ThemeProviderInterface, (*6)

...

use Themes\ModuleManager\Feature\ThemeProviderInterface;

...

class Module implements ThemeProviderInterface
{

    ...

    public function getDir()
    {
        return __DIR__;
    }

    public function getNamespace()
    {
        return __NAMESPACE__;
    }

    ...

}

The themes should be in a subfolder called themes inside the module directory. There should be, atleast, a theme called default., (*7)

Example tree: + themes + default + my_new_theme, (*8)

The layout file layout.phtml should be in the root of the theme, all the rest works just like Zend Framework's view folder., (*9)

Assets (CSS, JS, Images,...) can be stored in the assets folder under the theme. Here is an example entry for the default module., (*10)

  • default
    • assets
    • css
      • layout.css
      • bootstrap.css
    • js
      • jquery.js
    • application
    • index
      • index.phtml
    • layout.phtml

The module makes a route named assets. The url to assets is, (*11)

/assets/:modules/*

Where * is the relative path to the actual asset., (*12)

Making a port of a Zend Framework 2 application to a theme based applications should be a breeze as you only have to change the name of view forlder to default, move it into a folder named themes and move the layout file and you are ready., (*13)

The Versions

05/09 2013

dev-master

9999999-dev https://github.com/shadowfax/zf-themes

Theme system for ZF2

  Sources   Download

GPLv2

The Requires

 

template asset theme

05/09 2013

dev-experimental

dev-experimental https://github.com/shadowfax/zf-themes

Theme system for ZF2

  Sources   Download

GPLv2

The Requires

 

template asset theme