2017 © Pedro Peláez
 

cakephp-plugin cakephp-smarty

Make Smarty available with CakePHP.

image

node-link/cakephp-smarty

Make Smarty available with CakePHP.

  • Thursday, October 5, 2017
  • by n0f
  • Repository
  • 1 Watchers
  • 1 Stars
  • 36 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 1 Open issues
  • 3 Versions
  • 50 % Grown

The README.md

Smarty plugin for CakePHP

The Smarty plugin is a simple way to install Smarty view on your CakePHP 3 application with 3 steps., (*1)

Requirements

  • CakePHP 3.x
  • PHP 5.5+

Installation

1. Install plugin

You can install this plugin into your CakePHP application using composer., (*2)

The recommended way to install composer packages is:, (*3)

composer require node-link/cakephp-smarty

2. Load plugin

Use bin/cake to load the plugin as follows:, (*4)

bin/cake plugin load NodeLink/Smarty

Or, manually add the following to config/bootstrap.php:, (*5)

<?php
use Cake\Core\Plugin;

Plugin::load('NodeLink/Smarty');

3. Set View class

In the AppController.php of your application, specify the View class., (*6)

<?php
namespace App\Controller;
use Cake\Controller\Controller;
use Cake\Event\Event;

class AppController extends Controller
{
    public function beforeRender(Event $event)
    {
        $this->viewBuilder()->setClassName('NodeLink/Smarty.App');

        // Prior to CakePHP 3.4.0
        $this->viewBuilder()->className('NodeLink/Smarty.App');
    }
}

Configuration

If you want to change Smarty's behavior, you can change Smarty's behavior by writing config/app.php as follows., (*7)

<?php
return [
    // Add the following
    'Smarty' => [
        'debugging' => true,                            // Default: Configure::read('debug')
        'auto_literal' => true,                         // Default: true
        'escape_html' => true,                          // Default: false
        'left_delimiter' => '<!--{',                    // Default: '{'
        'right_delimiter' => '}-->',                    // Default: '}'
        'error_reporting' => E_ALL & ~E_NOTICE,         // Default: null
        'force_compile' => true,                        // Default: Configure::read('debug')
        'caching' => Smarty::CACHING_LIFETIME_CURRENT,  // Default: false
        'cache_lifetime' => 86400,                      // Default: 3600
        'compile_check' => true,                        // Default: true
        'compile_dir' => null,                          // Default: CACHE . 'views'
        'cache_dir' => null,                            // Default: CACHE . 'smarty'
        'config_dir' => null,                           // Default: CONFIG . 'smarty'
        'plugins_dir' => null,                          // Default: CONFIG . 'smarty' . DS . 'plugins'
        'template_dir' => null,                         // Default: APP . 'Template'
        'use_sub_dirs' => false,                        // Default: false
    ],
];

If the setting item is not filled out or null is set, the default value is used., (*8)

If you want to define plugins such as functions and modifiers, config/smarty/plugins is the plugins directory by default, so place the plugins in config/smarty/plugins., (*9)

Reporting Issues

If you have a problem with the Smarty plugin, please send a pull request or open an issue on GitHub., (*10)

The Versions

05/10 2017

dev-master

9999999-dev https://github.com/node-link/cakephp-smarty

Make Smarty available with CakePHP.

  Sources   Download

MIT

The Requires

 

The Development Requires

cakephp smarty

05/10 2017

v0.2.0

0.2.0.0 https://github.com/node-link/cakephp-smarty

Make Smarty available with CakePHP.

  Sources   Download

MIT

The Requires

 

The Development Requires

cakephp smarty

05/10 2017

v0.1.0

0.1.0.0 https://github.com/node-link/cakephp-smarty

Make Smarty available with CakePHP.

  Sources   Download

MIT

The Requires

 

The Development Requires

cakephp smarty