Statistics
2
0
0
35d
Badges
Dependencies

Strongly recommend use Kappa/ThemesManager.

If you use Modules structure Kappa/ThemesManager is more effective if not that is still better. Forgot on this package it was just attempt. Is deprecated and will not be more developed.

ldrahnik/theme-keeper

Build Status Latest stable Downloads total

Keeper of app themes.

Requirements

ldrahnik/theme-keeper requires PHP 5.4 or higher.

Installation

Install theme keeper to your project using Composer:

$ composer require ldrahnik/theme-keeper

Usage

Register extension in config file

extensions:
	themes: ThemeKeeper\DI\ThemeKeeperExtension

Example

themes:
	default:
		themeDir: %themesDir%/<themeName>
		assetsDir: <themeDir>/assets
		views:
			controls: <themeDir>/controls/<name>/<view>
			presenters: <themeDir>/presenters/<name>/<view>
			layouts: <themeDir>/@<view>
	/**
	* @var \ThemeKeeper\ThemeKeeper 
	* @inject 
	*/
	private $themes;
	
	public function __construct(ThemeKeeper\ThemeKeeper $themes)
    {
		$this->themes = $themes;
    }
    
    public function render()
    {
    	$this->template->setFile($this->themes->getView($this->name, 'controls'));
		$this->template->render();
		// you can cast getView without getTheme('default') because default name is automatically default
		// theme for short use as that, if is not set up name 'default', is choosen first theme in order
    }

Is able to set up path via these patterns (don't count patterns through view-keeper - substitution is done successively)

	<themeName>
	<assetsDir>
	<themeDir>

Summary

  • Template-keeper uses View-keeper but view-keeper as extension have still good use, for example Mail templates are the same for entire app.
  • Crossing from small app with view-keeper to something bigger is not hard because is possible to let code as it's, just use another service.

Is this addon outdated? Did you find an issue? Please report it.

Componette Componette admin@componette.com