[eluser]tomcode[/eluser]
I've written an extension for the Loader class which allows You to keep Your templates together with the other assets outside the system :
Code:
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
/**
* Extends the Loader Class
*
* Loads template files
*
* @package CodeIgniter
* @subpackage Libraries
* @author tomcode
* @category Loader
*/
class MY_Loader extends CI_Loader {
/**
* Load Template
*
* like the loader view method, but from app root
*
* @access public
* @param string
* @param array
* @param bool
* @return string
*/
function template($path, $vars = array(), $return = FALSE)
{
return $this->_ci_load(array('_ci_path' => $path.EXT, '_ci_vars' => $this->_ci_object_to_array($vars), '_ci_return' => $return));
}
}
Put it in application/libraries, it loads automatically.
Your file structure
themes/
theme_name/
css/
images/
php/
system/
index.php
Use it like that :
Code:
// send to browser
$this->load->template('theme_name/php/template_name', $data);
// load into variable
$template = $this->load->template('theme_name/php/template_name', $data, true);