Skip to content

Instantly share code, notes, and snippets.

@willmendesneto
Last active December 11, 2015 05:18
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 willmendesneto/4550963 to your computer and use it in GitHub Desktop.
Save willmendesneto/4550963 to your computer and use it in GitHub Desktop.
Inserindo Twig Template Engine no Codeigniter via Composer Localilzação dos arquivos: Welcome.php => application/controller/Welcome.php
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
*
* Arquivo inserido em application/controller/Welcome.php
*
*/
class Welcome extends CI_Controller {
/**
* Construtor da classe
*
* @return void
*/
public function __construct()
{
parent::__construct();
$this->load->library('Twig');
}
/**
* Envia para a pagina index do Controller
* @return void
*/
public function index()
{
try{
$data['title'] = "Testing Twig!!";
$this->twig->display('twig/index.html.twig', $data);
}catch(Exception $e){
show_error($e->getMessage().' --- '.$e->getTraceAsString());
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment