Doesn't share different view on same controller

#1
[eluser]shahriat[/eluser]
Hi, I have one controller named home and some functions named gallery, news etc. I am trying to use home_view on index function and gallery_view, news_view on gallery, news function but both gallery and news function just sharing the home_view and i never called home_view on my gallery and news function. Why this is happening i don't know. You the guys can help me!

--
Thanx

#2
[eluser]pistolPete[/eluser]
Post your controller code please.

#3
[eluser]shahriat[/eluser]
Below is my controller class


<?php

class Home extends Controller {

function Home()
{
parent::Controller();

}

function index()
{
// this array will contain some config variables
$header_data = array();
$header_data['base_url'] = config_item('base_url');
$mainmenus = $this->Menu_model->get_menu(0);
$header_data['mainmenus'] = $mainmenus;
$header_data['submenus'] = $this->Menu_model->get_menu_id($mainmenus[0]->menu_id);
$header_data['content'] = $this->Content_model->get_content_id($mainmenus[0]->menu_id);
// get news
$header_data['newses'] = $this->News_model->get_last_two_entries();
// get seo
$header_data['seo'] = $this->Seo_model->get_last_ten_entries();
// this codes will load the frontend views
$output = $this->load->view('header', $header_data, true);
$output.=$this->load->view('left', $header_data, true);
$output.=$this->load->view('home_body', $header_data, true);
$output.=$this->load->view('footer_menu', $header_data, true);
$output.=$this->load->view('footer', $header_data, true);
$this->output->set_output($output);
}


function news(){
// get segments
$arrseg = $this->uri->uri_to_assoc(3);
$news_id = $arrseg['nid'];
// this array will contain some config variables
$header_data = array();
$header_data['base_url'] = config_item('base_url');
$mainmenus = $this->Menu_model->get_menu(0);
$header_data['mainmenus'] = $mainmenus;
$header_data['submenus'] = $this->Menu_model->get_menu_id($mainmenus[0]->menu_id);
$header_data['content'] = $this->Content_model->get_content_id($mainmenus[0]->menu_id);
// get news
$header_data['newses'] = $this->News_model->get_last_two_entries();
$header_data['news_one'] = $this->News_model->get_one_record($news_id);
// get seo
$header_data['seo'] = $this->Seo_model->get_last_ten_entries();
// this codes will load the frontend views
$output = $this->load->view('header', $header_data, true);
$output.=$this->load->view('left', $header_data, true);
$output.=$this->load->view('news_body', $header_data, true);
$output.=$this->load->view('footer_menu', $header_data, true);
$output.=$this->load->view('footer', $header_data, true);
$this->output->set_output($output);
}


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.