2017 © Pedro Peláez
 

mako-package marty

Smarty view renderer for the Mako framework

image

solution-web/marty

Smarty view renderer for the Mako framework

  • Thursday, April 16, 2015
  • by solution-web
  • Repository
  • 1 Watchers
  • 0 Stars
  • 528 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 11 Versions
  • 0 % Grown

The README.md

Marty

Continuous
Integration Latest Stable
Version Total
Downloads License, (*1)

Marty is a simple Smarty view renderer for the Mako framework., (*2)

Requirements

Marty has been tested on all current Mako versions. Any other version may work, but has not been tested. Unit tests are run against PHP 7.0 and up. Smarty 3 or 4 is required, but will be pulled in as part of the installation., (*3)

Installation

Marty can be added to your Mako project using composer! Just add it to your requirements, (*4)

{
    /* Stuff */
    require: {
        /* Your other requirements */
        "bertptrs/marty": "*"
    }
    /* The rest of your composer.json*/
}

Usage

Once installed, you will need to add it to your packages list. You do this by adding it to the "Web" packages. This is located in the file app/config/application.php., (*5)

<?php
return [
    // …
    'packages' => [
        // …
        'web' => [
            'marty\MartyPackage',
        ],
    ],
    // …
];
?>

This enables the Smarty View renderer for every view with the ".tpl" file extension., (*6)

Configuration

Configuration can be done by changing the marty::smarty configuration. Just refer to the Mako documentation on package configuration for details., (*7)

The configuration properties are as follows:, (*8)

Configuration property Type Description Default
smarty.templateDir string The location to find smarty templates. Your app/views directory.
smarty.compileDir string The location to store compiled templates. A new directory smarty in your app/storage directory.
smarty.pluginDirs string[] A list of directories to search for smarty plugins. An empty array.

Plugins

Marty supports the plugin structure offered by Smarty, and extends it to use the dependency injector offered by the Mako framework., (*9)

Plugin dirs can be added to the config. The structure for plugins can be found in the Smarty Documentation. Due to the fact that Mako resolves parameters by name, Smarty plugin parameters should have their names as specified in the documentation. This means that the parameters should be named as follows:, (*10)

  • Template functions:
    • parameters should be named $params
    • The smarty template should be named $template
  • Modifiers:
    • The input data should be named $value
    • Any other values will be stored in array $params in order.
  • Block functions:
    • Call parameters should be named $params
    • The block content should be named $content
    • The template reference should be named $template
    • The repetition flag should be named $repeat.
  • Compiler functions:
    • Call parameters should be named $params
    • The Smarty reference should be named $smarty

As an example, we can build a small plugin that uses the I18n module of the framework., (*11)


function smarty_modifier_i18n($value, mako\i18n\I18n $i18n) { return $i18n->get($value); }

Then, we can use your plugin like this:, (*12)

Lets show {'some.translated.text'|i18n}.

Contributing

If there are any features in Smarty that cannot (easily) be used in the current package, or if there are Mako features that are hard to bind to Smarty, feel free to file an issue or a pull request., (*13)

Code style and such are ran using GrumPHP. Make sure that your files are in accordance to those rules., (*14)

The Versions

16/04 2015

dev-master

9999999-dev http://solution-web.nl/

Smarty view renderer for the Mako framework

  Sources   Download

MIT

The Requires

 

The Development Requires

by Bert Peters

template smarty mako

16/04 2015

v4.5.1

4.5.1.0 http://solution-web.nl/

Smarty view renderer for the Mako framework

  Sources   Download

MIT

The Requires

 

The Development Requires

by Bert Peters

template smarty mako

22/02 2015

v4.4.0

4.4.0.0 http://solution-web.nl/

Smarty view renderer for the Mako framework

  Sources   Download

MIT

The Requires

 

The Development Requires

by Bert Peters

template smarty mako

03/12 2014

v4.1.0

4.1.0.0 http://solution-web.nl/

Smarty view renderer for the Mako framework

  Sources   Download

MIT

The Requires

 

The Development Requires

by Bert Peters

template smarty mako

11/08 2014

v1.0.0

1.0.0.0 http://solution-web.nl/

Smarty view renderer for the Mako framework

  Sources   Download

MIT

The Requires

 

The Development Requires

by Bert Peters

template smarty mako

26/12 2013

v0.4.0

0.4.0.0 http://solution-web.nl/

Smarty view renderer for the Mako framework

  Sources   Download

MIT

The Requires

 

The Development Requires

by Bert Peters

template smarty mako

15/12 2013

v0.3.1

0.3.1.0 http://solution-web.nl/

Smarty view renderer for the Mako framework

  Sources   Download

MIT

The Requires

 

The Development Requires

by Bert Peters

template smarty mako

15/12 2013

v0.3.0

0.3.0.0 http://solution-web.nl/

Smarty view renderer for the Mako framework

  Sources   Download

MIT

The Requires

 

The Development Requires

by Bert Peters

template smarty mako

01/12 2013

v0.2.1

0.2.1.0 http://solution-web.nl/

Smarty view renderer for the Mako framework

  Sources   Download

MIT

The Requires

 

by Bert Peters

template smarty mako

25/11 2013

v0.2

0.2.0.0 http://solution-web.nl/

Smarty view renderer for the Mako framework

  Sources   Download

MIT

The Requires

 

by Bert Peters

template smarty mako

18/11 2013

v0.1

0.1.0.0 http://solution-web.nl/

Smarty view renderer for the Mako framework

  Sources   Download

MIT

The Requires

 

by Bert Peters

template smarty mako