In my codeigniter controller function I am using the following code to generate my view and insert all the necessary content:
$left_column = $this->load->view('widgets/sub_navigation', $subnav_data, true);
$left_column .= $this->load->view('widgets/search_box', '', true); //Set data to be loaded into columns
$left_column_base = $this->load->view('widgets/assist_navigation', '', true);
$center_column = 'this is center column';
$right_column = $this->load->view('widgets/ask_us_a_question', '', true);
$right_column .= $this->load->view('widgets/newsletter', '', true);
$right_column .= $this->load->view('widgets/latest_news', '', true);
$this->template->inject_partial('left_column', $left_column); //Inject data into the partial columns
$this->template->inject_partial('left_column_base', $left_column_base);
$this->template->inject_partial('center_column', $center_column);
$this->template->inject_partial('right_column', $right_column);
$this->template->build('template',$data);
I am using a three column layout and the code above dictates what is shown in each of the columns. It works in a very modular way allowing me to customize each page quickly.
Is there a way of simplifying the above code, using arrays maybe, to cut down on repetetive code, making things more DRY??