[eluser]Devon Lambert[/eluser]
Here's how I fixed it all Phil. I noticed you made an assumption when building this library, and that is that everyone would want any view served up within a theme to be parsed through the parser library. I can see how this would normally make perfect sense but in my case, I will be the only one making changes to my templates, so I'll opt for the small speed boost from not using the parser class, thank you very much. :-)
Since I don't plan on ever using the parser library (nor do I assume that a view within a theme requires a parser)
I change the following at line 48:
Code:
private $_parser_enabled = TRUE;
to:
Code:
private $_parser_enabled = FALSE;
I also change the following at line 161:
Code:
if($this->_parser_enabled === TRUE || $this->_theme)
to:
Code:
if($this->_parser_enabled === TRUE)
Finally, I replaced the following bit of code at line 346:
Code:
$this->CI->load->library('parser');
return $this->CI->parser->parse('../'.$theme_view, $this->data, TRUE);
to:
Code:
if($this->_parser_enabled === TRUE) {
$this->CI->load->library('parser');
return $this->CI->parser->parse('../'.$theme_view, $this->data, TRUE);
} else {
return $this->CI->load->view('../'.$theme_view, $this->data, TRUE);
}
Now on to the fix
At line 110:
I changed:
Code:
$template['partials'][$name] = $this->_load_view( $partial['view'] , $partial['search']);
to:
Code:
$template['partials'][$name] = $this->_load_view( $partial['view'] , $partial['search'], TRUE);
then at line 337:
change:
Code:
private function _load_view($view = '', $search = TRUE)
to:
Code:
private function _load_view($view = '', $search = TRUE, $partial = FALSE)
Finally, I needed to modify the $theme_view search function
Replace line 342:
Code:
$theme_view = 'themes/' . $this->_theme . '/views/modules/' . $this->_module . '/' . $view;
with:
Code:
// Do we have a partial view within a module within a theme?
if ($this->_theme && $this->_module && $partial) {
$theme_view = 'themes/' . $this->_theme . '/views/modules/' . $this->_module . '/partials/' . $view;
} else if ($this->_theme && $partial) { // Do we have a partial view within a theme?
$theme_view = 'themes/' . $this->_theme . '/views/partials/' . $view;
} else if ($this->_theme && $this->_module) { // Do we have a view within a module within theme?
$theme_view = 'themes/' . $this->_theme . '/views/modules/' . $this->_module . '/' . $view;
} else if ($this->_theme ) { // Do we have a view within a theme?
$theme_view = 'themes/' . $this->_theme . '/views/' . $view;
}
There may be a better way to accomplish the above, but this all works for me, for now. :-)