- PHP >= 7.1.x
- CakePHP >= 3.6.x
Download Smarty from here
Extract it to app/vendor/smarty
composer require smarty/smartyCopy the SmartyView.php file from src > View folder to your View folder.
Load SmartyView in your CakePHP project like in AppController.php file or below:
namespace App\Controller;
use Cake\Controller\Controller;
use Cake\Event\Event;
class AppController extends Controller
{
// Your code
public function beforeRender(Event $event)
{
$this->viewBuilder()->setClassName('Smarty'); // SET SMARTY VIEW
}
// Your code
}Rename all template files with .ctp extension in .tpl extension.
IMPORTANT: You can rename all, not just the templates and include all with Smarty include {include file="_file_.tpl"} syntax.
{$this->fetch('content')}
Enjoy ;)