Welcome Guest, Not a member yet? Register   Sign In
[SOLVED] practice with views
#3

[eluser]SPeed_FANat1c[/eluser]
Your idea is good - if you want to add some data that is the same to all views, you simply add it in MY_Controller librarty and all views have that data (for example links on the sidebar are the same everywhere). Before I read your post I did the similar thing:

Code:
//header
        $data['title'] = '';
        $data['general'] = $this->Views_model->data_for_header();
        //most left menu - 0
        $data['current_menu'] = 0;
        $data['javascript'] = '';
        $data['meta'] = array(
                0 => '<meta name="Description" content="Information architecture, Web Design, Web Standards." />',
                1 => '<meta name="Keywords" content="your, keywords" />',
                2 => '<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />',
                3 => '<meta name="Distribution" content="Global" />',
                4 => '<meta name="Robots" content="index,follow" />'
            );
        $this->load->view('header_view',$data);
        
        //main
        $data_main = array();
        $this->load->view('home_view',$data_main);
        
        //sidear and footer
        $data_sidebar['general'] = $this->Views_model->data_for_sidebar();
        $this->load->view('sidebar_view',$data_sidebar);
        
        $data_footer['general'] = $this->Views_model->data_for_footer();
        $this->load->view('footer_view',$data_footer);

The only thing I hate there is many lines for every page. But with you example it would also be similar, if you want load differrent title, javascript, metadata, other parameters for every page, you have to add many lines.

But yours looks shorter than mine eveen if we add different data, which is good Smile


Messages In This Thread
[SOLVED] practice with views - by El Forum - 12-06-2010, 02:01 PM
[SOLVED] practice with views - by El Forum - 12-08-2010, 03:46 PM
[SOLVED] practice with views - by El Forum - 12-09-2010, 02:49 AM
[SOLVED] practice with views - by El Forum - 12-09-2010, 04:47 AM
[SOLVED] practice with views - by El Forum - 12-10-2010, 10:37 AM
[SOLVED] practice with views - by El Forum - 12-10-2010, 01:17 PM
[SOLVED] practice with views - by El Forum - 12-11-2010, 02:17 AM



Theme © iAndrew 2016 - Forum software by © MyBB