2017 © Pedro Peláez
 

library nette-templating

Localizable templates with smooth setup in Nette Framework

image

dotblue/nette-templating

Localizable templates with smooth setup in Nette Framework

  • Monday, May 12, 2014
  • by vojtechdobes
  • Repository
  • 5 Watchers
  • 5 Stars
  • 3,039 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 5 Versions
  • 0 % Grown

The README.md

Localizable templates with smooth setup in Nette Framework

Requirements

Installation

  1. Copy source codes from Github or using Composer:
$ composer require dotblue/nette-templating@~1.0
  1. Register as Configurator's extension:
extensions:
    templateHelpers: DotBlue\Templating\Helpers\Extension
  1. Register your helpers:
templateHelpers:
    - ShoutHelper

How should MyHelper look?

use DotBlue\Templating\Helpers;

class ShoutHelper implements Helpers\IHelper
{

    public function getName()
    {
        return 'shout';
    }

    public function execute($value, Helpers\Options $options)
    {
        return $value . '!';
    }

}

All arguments are wrapped in Options object., (*1)

public function execute($value, Helpers\Options $options)
{
    $mark = $options->first('!');
    return $value . $mark;
}
{var $text = 'Hi'}
{$text|shout:'!!!'} {* print "Hi!!!" *}

Localization

You can use new macro {locale $language /} in your templates (best place is your layout). Provided $language variable is then available in helper via Options object:, (*2)

$language = $options->getLocale();

$language can be anything you wish. You can also place {locale} macro in template multiple times, for example to print amount of money in all localized versions (using hypothetical currency helper):, (*3)

{foreach $languages as $language}
    {locale $language}
        {$money|currency}
    {/locale}
{/foreach}

The Versions

12/05 2014

dev-master

9999999-dev

Localizable templates with smooth setup in Nette Framework

  Sources   Download

BSD-3-Clause

The Requires

 

helpers nette templates

12/05 2014

2.0.0

2.0.0.0

Localizable templates with smooth setup in Nette Framework

  Sources   Download

BSD-3-Clause

The Requires

 

helpers nette templates

28/03 2014

1.0.2

1.0.2.0

Localizable templates with smooth setup in Nette Framework

  Sources   Download

BSD-3-Clause

The Requires

 

helpers nette templates

27/03 2014

1.0.1

1.0.1.0

Localizable templates with smooth setup in Nette Framework

  Sources   Download

BSD-3-Clause

The Requires

 

helpers nette templates

24/03 2014

1.0.0

1.0.0.0

Localizable templates with smooth setup in Nette Framework

  Sources   Download

BSD-3-Clause

The Requires

 

helpers nette templates