Welcome Guest, Not a member yet? Register   Sign In
Best place to put a method that prepare the views ?
#4

[eluser]InsiteFX[/eluser]
You could put it in a library, but then you would need to use the CI Super Object to access your views.
Something like this:
Code:
private function _renderView($titrePage, $curPage, $contentData, $headerHTML = 'headers/default', $footerHTML = 'footers/default')
    {
        $CI =& get_instance();

        // 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->CI->load->view('headers/default', $headerData);
        $this->CI->load->view($curPage, $contentData);
        $this->CI->load->view('footers/default', $footerData);
    }

InsiteFX


Messages In This Thread
Best place to put a method that prepare the views ? - by El Forum - 04-23-2011, 10:31 AM
Best place to put a method that prepare the views ? - by El Forum - 04-23-2011, 02:47 PM
Best place to put a method that prepare the views ? - by El Forum - 04-23-2011, 03:00 PM
Best place to put a method that prepare the views ? - by El Forum - 04-23-2011, 09:19 PM
Best place to put a method that prepare the views ? - by El Forum - 04-24-2011, 08:58 AM
Best place to put a method that prepare the views ? - by El Forum - 04-24-2011, 09:45 AM
Best place to put a method that prepare the views ? - by El Forum - 04-24-2011, 09:46 AM
Best place to put a method that prepare the views ? - by El Forum - 04-24-2011, 10:22 AM
Best place to put a method that prepare the views ? - by El Forum - 04-24-2011, 10:25 AM



Theme © iAndrew 2016 - Forum software by © MyBB