Welcome Guest, Not a member yet? Register   Sign In
[solved] CI loads not the right view after upgrading
#1

[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 => '&lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /&gt;',
                1 => '&lt;meta name="Distribution" content="Global" /&gt;',
                2 => '&lt;meta name="Robots" content="index,follow" /&gt;',
                3 => '&lt;meta name="Keywords" content="Ylakiu globos namai, ylakiu seneliu namai" /&gt;',
                4 => '&lt;meta name="Description" content="Ylakių globos namų tinklalapis" /&gt;'
            );
                
        $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 => '&lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /&gt;',
            );
    $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?


Messages In This Thread
[solved] CI loads not the right view after upgrading - by El Forum - 03-31-2011, 05:46 AM
[solved] CI loads not the right view after upgrading - by El Forum - 03-31-2011, 06:36 AM
[solved] CI loads not the right view after upgrading - by El Forum - 03-31-2011, 07:26 AM
[solved] CI loads not the right view after upgrading - by El Forum - 03-31-2011, 07:49 AM
[solved] CI loads not the right view after upgrading - by El Forum - 03-31-2011, 08:04 AM
[solved] CI loads not the right view after upgrading - by El Forum - 03-31-2011, 09:13 AM
[solved] CI loads not the right view after upgrading - by El Forum - 03-31-2011, 09:21 AM
[solved] CI loads not the right view after upgrading - by El Forum - 03-31-2011, 09:24 AM
[solved] CI loads not the right view after upgrading - by El Forum - 03-31-2011, 09:44 AM
[solved] CI loads not the right view after upgrading - by El Forum - 03-31-2011, 10:14 AM
[solved] CI loads not the right view after upgrading - by El Forum - 03-31-2011, 10:19 AM



Theme © iAndrew 2016 - Forum software by © MyBB