• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Page Navigation

#1
[eluser]Unknown[/eluser]
Hi,
Am new in codeigniter.need help to fix route issues
Am building a small application with codeigniter but am having challenges with navigating from one page to another.

firstly: i have an admin called http://localhost/koeweb/dashboard which loads fine.
secondly: am trying to go to another page within the admin,say http://localhost/koeweb/dashboard/page2 and i get 404 Page Not Found.

My Route:
$route['(:any)'] = "home/$1";
$route['default_controller'] = "home";
$route['dashboard/(:any)'] = "dashboard/$1";
$route['dashboard'] = "dashboard";

My controller:
Code:
<?php

class Dashboard extends CI_Controller{
  
    public function __construct() {
        parent::__construct();
        $this->load->model('parish_model');
    }

    public function index(){
            
        $this->load->view('dashboard/inc/header_view');
        $data['query'] = $this->parish_model->getParish();
        $this->load->view('dashboard/dashboard_view', $data);
        $this->load->view('dashboard/inc/footer_view');
    }
  
    public function page2(){
        $this->load->view('dashboard/inc/header_view');
        $this->load->view('dashboard/add_parish');
        $this->load->view('dashboard/inc/footer_view');
    }
}


#2
[eluser]CroNiX[/eluser]
What's your base_url set to? Also, your first route should really be the last. Routes work from top down, as soon as something matches, it will use that route. (:any) will match anything, so should be last after all other named routes.

#3
[eluser]Unknown[/eluser]
Code:
$config['base_url'] = 'http://localhost/koeweb/';

Please how can i navigate from one page to another?
Thanks

#4
[eluser]InsiteFX[/eluser]
Use CI anchor see the url_helper in the Users Guide


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


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