CodeIgniter Forums
Page Navigation - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Page Navigation (/showthread.php?tid=61037)



Page Navigation - El Forum - 09-03-2014

[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');
    }
}




Page Navigation - El Forum - 09-03-2014

[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.


Page Navigation - El Forum - 09-04-2014

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

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


Page Navigation - El Forum - 09-04-2014

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