Skip to content

Instantly share code, notes, and snippets.

@kurozumi
Last active August 29, 2015 14:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kurozumi/bea4a11843b359196b32 to your computer and use it in GitHub Desktop.
Save kurozumi/bea4a11843b359196b32 to your computer and use it in GitHub Desktop.
【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