Welcome Guest, Not a member yet? Register   Sign In
Extending the Loader class (more or less)
#4

[eluser]Rick Jolly[/eluser]
The only problem with your code is that you are calling private CI core methods that aren't part of the public API (_ci_load() and _ci_object_to_array()). A couple of alternatives:
Code:
#1.
<?php
// application/controllers/MyControllerBase.php
class MyControllerBase extends Controller {
    var $theme = NULL;
    function loadview($view, $vars = array(), $return = FALSE)
    {
       $folder = '';
       if (!is_null($this->theme)) {
           $folder = 'themes/'.$this->theme.'/';
       }
      
       if ($return) {
           return $this->load->view($folder.$view, $vars, true);
       }
       else {
           $this->load->view($folder.$view, $vars);
       }
    }
}
?>

#2.
// or more simply, add a method that appends the theme folder to the view
$view = $this->getViewPath('someView');
$this->load->view($view, $vars); // or $this->load->view($view, $vars, true);


Messages In This Thread
Extending the Loader class (more or less) - by El Forum - 10-07-2007, 08:15 AM
Extending the Loader class (more or less) - by El Forum - 10-07-2007, 08:49 AM
Extending the Loader class (more or less) - by El Forum - 10-07-2007, 09:09 AM
Extending the Loader class (more or less) - by El Forum - 10-07-2007, 11:14 AM
Extending the Loader class (more or less) - by El Forum - 12-13-2007, 03:32 PM



Theme © iAndrew 2016 - Forum software by © MyBB