a skeletal controller for codeigniter
Some time back, I wrote a library-helper for CodeIgniter that brings Django/Jinja template inheritance to CI views. There are a couple of implementations out there, but I decided to write my own as an exercise mostly, but also to keep closer to the original syntax and style.
It works great. Here's a modified version of the controller I'm using for a mostly static site:
<?php
class Site extends Controller {
static special_funcs = array(
'do_smtg_special'
);
function _ji_view($view) {
$this->load->library(JINJA_INHERITANCE_DIRNAME.'/JI_Loader', NULL, 'ji_load');
$this->ji_load->view($view);
}
function _remap($page) {
if (array_key_exists($page, self::$special_funcs))
call_user_func(array(&$this, $page));
else
$this->_ji_view("page-{$page}");
}
}
?>
A better-documented, kept up-to-date version can be found in the documentation for the library.