PHP code example of gourmet / liquid
1. Go to this page and download the library: Download gourmet/liquid library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
gourmet / liquid example snippets
\Cake\Core\Plugin::load('Gourmet/Liquid');
// in ProductsController.php beforeFilter
$this->viewClass = '\Gourmet\Liquid\View\View';
// passed to any email configuration as the 'viewRender' key and use it:
Email::config(['user' => ['viewRender' => '\Gourmet\Liquid\View\View']]);
$email = new Email('user');
$email->template('Hello {{ name }}', "{{ 'content' | fetch }}\n\nThis is an automated email.")
->to('[email protected]')
->viewVars(['name' => 'Baker'])
->send();