LoginSignup
2
2

More than 5 years have passed since last update.

How to use Smarty with CakePHP 3.0

Last updated at Posted at 2014-12-14

This is a tutorial for installing Smarty to CakePHP 3.0.

In :日本語
In :español

Steps

1. Download the SmartyView

from here: https://github.com/yukikikuchi/cakephp3-smartyview
Save SmartyView as app/src/View/SmartyView.php

2. Download the smarty template engine

http://smarty.php.net/download.php
Extract it to app/vendor/smarty

3. Include in your controller

(in AppController.php to do it app-wide)

AppController.php

class AppController extends Controller {
    public $viewClass = 'App\View\SmartyView';
}

4. Create the layout file

Create a file app/src/Template/Layout/default.tpl and paste in that file:

default.tpl

{$this->fetch('content')}

2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2