2017 © Pedro Peláez
 

library slim-view-plates

A custom Slim framework view for the Plates template system.

image

media32/slim-view-plates

A custom Slim framework view for the Plates template system.

  • Thursday, March 5, 2015
  • by media32
  • Repository
  • 1 Watchers
  • 2 Stars
  • 821 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 7 Forks
  • 0 Open issues
  • 4 Versions
  • 1 % Grown

The README.md

Custom Slim Framework view for the Plates

This library provides a custom view for the Slim Framework to support the Plates template engine., (*1)

Usage

Add the provider to your composer.json file:, (*2)

{
    "require": {
        "media32/slim-view-plates": "3.*"
    }
}

Enable it in your application, (*3)

```php $view )); ``` ## Configuration ### Template File Extension Set `$view->fileExtension` to the file extension used for all templates. By default Plates expects the extension to be `.php`. ### Templates Path Set `$view->templatesPath` to the location of the templates. By default Slim-View-Plates will use the Slim templates.path configuration value. This setting allows you to override that value for only the Plates templates. ### Templates Folder Add to the `$view->templatesFolders` array, where the key is the name of the folder and the value is the path. ### Extension You can access Slim's URL functions inside templates by hooking up the view extension: ```php $view->parserExtensions = array( new \Media32\Slim\View\PlatesExtension() ); ``` #### URL Inside your Plates template you would write: = $this->slim()->urlFor('hello', array('name' => 'Josh', 'age' => '19')); ?>, (*4)

You can easily pass variables that are objects or arrays by doing:, (*5)

<a href="<?= $this->slim()->urlFor('hello', array('name' => $person->name, 'age' => $person->age)) ?>">Hello <?= $name; ?></a>

If you need to specify the appname for the getInstance method in the urlFor functions, set it as the third parameter of the function in your template:, (*6)

<a href="<?= $this->slim()->urlFor('hello', array('name' => $person->name, 'age' => $person->age), 'admin') ?>">Hello <?= $name; ?></a>

Site URL

Inside your Plates template you would write:, (*7)

<?= $this->slim()->siteUrl('/about/me'); ?>

Base URL

Inside your Plates template you would write:, (*8)

<?= $this->slim()->baseUrl(); ?>

Slim Instance

Inside your plates template you would write:, (*9)

<? $this->slim()->getInstance('appname'); ?>

Advanced Usage

To access the Plates engine object for further customization, including loading extensions, call $view->getInstance()., (*10)

The Versions

05/03 2015

dev-master

9999999-dev http://github.com/media32/slim-view-plates

A custom Slim framework view for the Plates template system.

  Sources   Download

MIT

The Requires

 

templating slim plates

09/01 2015

3.0

3.0.0.0 http://github.com/media32/slim-view-plates

A custom Slim framework view for the Plates template system.

  Sources   Download

MIT

The Requires

 

templating slim plates

09/08 2014

v2.0.0

2.0.0.0 http://github.com/philipsharp/slim-view-plates

Custom Slim Framework view for the Plates template system

  Sources   Download

MIT

The Requires

 

templating slim plates

21/02 2014

v1.0.0

1.0.0.0 http://github.com/philipsharp/slim-view-plates

Custom Slim Framework view for the Plates template system

  Sources   Download

MIT

The Requires

 

The Development Requires

templating slim plates