[eluser]SPeed_FANat1c[/eluser]
Hi,
I upgraded the site from 1.73 to 2.0.1 but when going to
http://localhost/ubagynasCI2/ I get an error:
A PHP Error was encountered
Severity: Notice
Message: Undefined variable: content
Filename: views/info_page_view.php
Line Number: 2
and I see it loads not the right view, here is the controller code.
Code:
function index($offset = 0)
{
$this->load->model('Nustatymai_model','nust');
$this->load->model('News_model','News');
$this->load->library('pagination');
$config['base_url'] = base_url().'home/index/';
$config['total_rows'] = $this->News->totalNews();
$config['per_page'] = $this->nust->getNaujienu_sk_puslapyje();
$config['first_link'] = 'Pirmas';
$config['last_link'] = 'Paskutinis';
$config['full_tag_open'] = '<div class = "pagination">';
$config['full_tag_close'] = '</div>';
$this->pagination->initialize($config);
$this->data['current_menu'] = $this->where_is_pradzia_menu();
$this->data['title'] = 'Ylakių globos namai';
$this->data['meta'] = array(
0 => '<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />',
1 => '<meta name="Distribution" content="Global" />',
2 => '<meta name="Robots" content="index,follow" />',
3 => '<meta name="Keywords" content="Ylakiu globos namai, ylakiu seneliu namai" />',
4 => '<meta name="Description" content="Ylakių globos namų tinklalapis" />'
);
$this->data['news'] = $this->News->getNews($offset,$config['per_page']);
$this->display('home_view');
}
you see there is line
Code:
$this->display('home_view');
So it should load the home_view, not the info_page_view
The MY_Controller:
Code:
class MY_Controller extends CI_Controller{
var $data;
public function __construct(){
parent::__construct();
//default data
$this->data['title'] = 'Ylakių globos namai';
$this->data['meta'] = array(
0 => '<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />',
);
$this->data['javascript'] = '';
$this->data['virsutinis_meniu'] = $this->get_top_menu();
$this->data['current_menu'] = 99; //99 reiskia joks meniu nera aktyvus
//sidearui
$this->data['links'] = $this->get_links();
$this->data['banners'] = $this->get_banners();
/*
//footeriui, jie noresim dinaminiu duomenu
$this->data['footer'] = $this->Views_model->data_for_footer();
*/
}
/*
* paduodam main sekcijos view faila, taip pat kaip ir this load view kai paduodume
*/
function display($main_view){
$this->load->vars($this->data);
$this->load->view('header_view');
$this->load->view($main_view);
$this->load->view('sidebar_view');
$this->load->view('footer_view');
}
private function get_top_menu()
{
$this->db->order_by('Eile','asc');
$query = $this->db->get('virsutinis_meniu');
return $query->result_array();
}
private function get_links()
{
$query = $this->db->order_by('vieta','asc')->get('nuorodos');
return $query->result();
}
function get_banners()
{
$query = $this->db->order_by('queue','asc')->get('reklama');
return $query->result();
}
}
In routes.php there are such lines:
Code:
$route['default_controller'] = "home";
$route['scaffolding_trigger'] = "";
$route['((?!admin|admin_|galerija|home|test).*)'] = "home/info/$1";
In CI 1.73 it loads the right view. But it looks like it is not calling the index function in home controller. And calls home/info instead of it. Why could that be?