Colin—great library. Thank you for putting it together.
I’m a chain monkey. Like this:
$this->template->write_view('content', 'app_edit', $data)->render();
I don’t know if it’s affects PHP4 users, but if you return $this at the end of methods like write_view, you enable those of us using PHP5 to chain. Just a suggestion!
function write_view($region, $view, $data = NULL, $overwrite = FALSE)
{
$args = func_get_args();
// Get rid of non-views
unset($args[0], $args[2], $args[3]);
// Do we have more view suggestions?
if (count($args) > 1)
{
foreach ($args as $suggestion)
{
if (file_exists(APPPATH .'views/'. $suggestion . EXT) or file_exists(APPPATH .'views/'. $suggestion))
{
// Just change the $view arg so the rest of our method works as normal
$view = $suggestion;
break;
}
}
}
$content = $this->CI->load->view($view, $data, TRUE);
$this->write($region, $content, $overwrite);
return $this;
}