nezumi/mysmarty

There is no license information available for the latest version (v0.9-alpha) of this package.

A template engine which imitate smarty for php

v0.9-alpha 2018-05-24 06:22 UTC

README

A template engine for php.

Installation

Use composer to install nezumi/mysmarty in your project:

composer require nezumi/mysmarty

Usage

use Nezumi\MySmarty; 

define('DC', DIRECTORY_SEPARATOR);
define('APP',__DIR__.DC);
$template_dir = APP.'templates'.DC;
$compie_dir = APP.'templates_c'.DC;

$data = array(
	array('name'=>'Nezumi'),
	array('name'=>'Jimmy'),
	array('name'=>'JameGold'),
);

$smarty = new MySmarty();

$smarty->debug = true;  //the debug enable
$smarty->setTemplateDir($template_dir);
$smarty->setCompileDir($compie_dir);
$smarty->assign('name', 'Nezumi');
$smarty->assign('title', 'HelloWorld');
$smarty->assign('code', 1);
$smarty->assign('data', $data);
$smarty->display('index.html');