[eluser]Rushino[/eluser]
Hello,
I have a method in my controller called renderViews. It actually take 3 views to render to the user.
I am afraid that this method get repeated in each controller.. the problem is that this method use the load function. So it may be needed in the controller.. but i try to find a way to relocalize this method.
So what is the best place to put this method ?
Here a sample of this method..
Code:
private function _renderView($titrePage, $curPage, $contentData, $headerHTML = 'headers/default', $footerHTML = 'footers/default')
{
// Create data object for the header
$headerData['titre'] = $titrePage;
$headerData['navigation'] = $this->_generateNavigation($curPage);
// Create data object for the footer
$footerData['copyright'] = "APP_COPYRIGHT";
// Render to views
$this->load->view('headers/default', $headerData);
$this->load->view($curPage, $contentData);
$this->load->view('footers/default', $footerData);
}
Thanks.