Подключаем Popcorn к CodeIgniter

1. Копируем папку /popcorn/ в /application/libraries/
2. Создаем в папке /application/libraries/ файл Templates.php
<?php

require_once('popcorn/popcorn.class.php');

class Templates extends Popcorn {

  function __construct() { 
    popcorn::configure('popcorn_tpl_ext','php');
    popcorn::configure('popcorn_tpl_dir','application/views/');
    popcorn::configure('popcorn_tpl_c_dir','templates_c/');
  }

}
?>


3. В контроллере загружаем библиотеку.
$this->load->library('templates');

4. Используем в шаблонах :)
$this->templates->assign('msg','Hello CI !');
$this->templates->draw('welcome_message');

Комментариев нет: