Skip to content

pfilsx/simply

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Simply - Simple flexible PHP template engine

Installation

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"
}

Configuration

You can use next settings:

  1. templatesDirectory - path to your templates directory(default: 'views')
  2. globalVariables - array with global variables for yours templates(optional, default: []. Can be extended by $simply->assign())
  3. layout - path to your layout from templates directory(optional, default: null)

Usage

$simply = new Simply(array('templatesDirectory' => 'templates', 'layout' => 'main'));
$simply->assign('title', 'Заголовок'); // add global variable
$simply->display('index', array('text' => 'Текст')); // display 

See demo directory.

Methods

  1. display(string $view, array $params = []) : void - render template from file.
  2. render(string $view, array $params = []) : string - compile template from file into string variable.
  3. renderString(string $content, array $params = []) : string - render template from string content.
  4. displayString(string $content, array $params = []) : void - compile template from string content into string variable.
  5. assign(string $name, mixed $value) : void - add variable into global variables array.
  6. encode(string $content) : string - escape html characters.

About

Simple flexible PHP template engine

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages