[eluser]Arjen van Bochoven[/eluser]
I know php4 is end-of-life at the start of next year, but it might still take a long time for isp's to make the move to php5.
I ran into the following problem, I need to extend CI_Loader to accomodate a function that loads views from an arbitrary filepath:
Code:
class MY_Loader extends CI_Loader {
// --------------------------------------------------------------------
/**
* Load View by path
*
*
* @access public * @param string
* @param array
* @param bool
* @return void
*/
function view_fp($view, $vars = array(), $return = FALSE)
{
return $this->_ci_load(array('path' => $view, 'vars' => $this->_ci_object_to_array($vars), 'return' => $return));
}
}
This works fine in php5, the problem is that the function is not available in php4 as $this->load->view_fp();
The only solution I could come up with is tangling with
Code:
/system/codeigniter/Base4.php
I changed CI_Loader to MY_Loader
Code:
class CI_Base extends MY_Loader {
function CI_Base()
{
// This allows syntax like $this->load->foo() to work
parent::MY_Loader();
$this->load =& $this;
Does anyone have a better solution?
thnx
Arjen