PHP Class Twig

Author: Bennet Matschullat ([email protected])
Author: Erik Torsner ([email protected])
Show file Open project: kenjis/codeigniter-ss-twig Class Usage Examples

Public Methods

Method Description
__construct ( $params = [] )
addGlobal ( string $name, mixed $value ) Registers a Global
display ( string $view, array $params = [] ) Renders Twig Template and Set Output
getTwig ( ) : Twig_Environment
render ( string $view, array $params = [] ) : string Renders Twig Template and Returns as String
safe_anchor ( string $uri = '', string $title = '', array $attributes = [] ) : string

Protected Methods

Method Description
addFunctions ( )
createTwig ( )
resetTwig ( )
setLoader ( $loader )

Method Details

__construct() public method

public __construct ( $params = [] )

addFunctions() protected method

protected addFunctions ( )

addGlobal() public method

Registers a Global
public addGlobal ( string $name, mixed $value )
$name string The global name
$value mixed The global value

createTwig() protected method

protected createTwig ( )

display() public method

Renders Twig Template and Set Output
public display ( string $view, array $params = [] )
$view string Template filename without `.twig`
$params array Array of parameters to pass to the template

getTwig() public method

public getTwig ( ) : Twig_Environment
return Twig_Environment

render() public method

Renders Twig Template and Returns as String
public render ( string $view, array $params = [] ) : string
$view string Template filename without `.twig`
$params array Array of parameters to pass to the template
return string

resetTwig() protected method

protected resetTwig ( )

safe_anchor() public method

public safe_anchor ( string $uri = '', string $title = '', array $attributes = [] ) : string
$uri string
$title string
$attributes array [changed] only array is acceptable
return string

setLoader() protected method

protected setLoader ( $loader )