1 Add next into composer.json
require
"pfilsx/simply" : "*"
2 Add next into composer.json
repositories
{
"type": "git",
"url": "https://github.com/pfilsx/simply.git"
}
You can use next settings:
templatesDirectory
- path to your templates directory(default:'views'
)globalVariables
- array with global variables for yours templates(optional, default:[]
. Can be extended by$simply->assign()
)layout
- path to your layout from templates directory(optional, default:null
)
$simply = new Simply(array('templatesDirectory' => 'templates', 'layout' => 'main'));
$simply->assign('title', 'Заголовок'); // add global variable
$simply->display('index', array('text' => 'Текст')); // display
See demo directory.
display(string $view, array $params = []) : void
- render template from file.render(string $view, array $params = []) : string
- compile template from file into string variable.renderString(string $content, array $params = []) : string
- render template from string content.displayString(string $content, array $params = []) : void
- compile template from string content into string variable.assign(string $name, mixed $value) : void
- add variable into global variables array.encode(string $content) : string
- escape html characters.