Skip to content

Instantly share code, notes, and snippets.

@kurozumi
Last active Aug 29, 2015
Embed
What would you like to do?
【CodeIgniter3】Twig導入用のシンプルライブラリ
<?php
class Twig
{
public function __construct()
{
$this->ci =& get_instance();
$loader = new Twig_Loader_Filesystem(VIEWPATH);
$this->twig = new Twig_Environment($loader, array('cache' => APPPATH . "cache/twig", "debug" => true));
}
public function display($name, array $context = array())
{
$this->ci->output->set_output($this->twig->render($name, $context));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment