CodeIgniter Forums

Full Version: Well-formed URI routing, need help
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]MaxEisley[/eluser]
Hello,

i have class website with 4 pages (classes)
main, carlist, order, articles

and now i am working on admin panel, there is just 1 class admin

In admin panel si menu like Cars, Workers, Orders, Customers, Articles

When i click on Cars, uri is index.php/admin/car there is a list of cars
I can edit or delete car, url is
index.php/admin/car/edit/1
index.php/admin/car/delete/1

In admin.php class (controller) i have public function car which containt function edit(), here is code:
Code:
<?php
class Admin extends CI_Controller {
  
    public function index() {
       $this->load->helper(array('form', 'url'));
       $this->load->library('session');
     $data['page_title'] = "Půjčovna aut - Admin";
       $data['page_keywords'] = "Půjčovna aut - Admin";
       $data['page_description'] = "Půjčovna aut - Admin";
       $data['furl'] = "http://localhost/www/DBS2/index.php";
     $this->load->model('data_model');
    
     $this->data_model->adminlogin($this->input->post('Login'), $this->input->post('Password'));
    
     $this->load->view('header', $data);
      
     if($this->session->userdata('person')) {
        $this->load->view('admin_panel', $data);
     }
    
     else {
        $this->load->view('admin_login', $data);
     }
  
       $this->load->view('footer', $data);
    }
    
    public function car() {
       $this->load->helper(array('form', 'url'));
       $this->load->library('session');
     $data['page_title'] = "Půjčovna aut - Admin";
       $data['page_keywords'] = "Půjčovna aut - Admin";
       $data['page_description'] = "Půjčovna aut - Admin";
       $data['furl'] = "http://localhost/www/DBS2/index.php";
     $this->load->model('data_model');
    
       if (!$this->session->userdata('person')) {
        $this->load->view('admin_login', $data);
     }
    
     $this->load->view('header', $data);
       $this->load->view('admin_panel', $data);
    
     $data['cars'] = $this->data_model->getallcars();
     $this->load->view('admin_car', $data);

      
       function edit() {
         $data['car'] = $this->data_model->getcar($this->uri->segment(3));
         $this->load->view('admin_car_edit', $data);
     }
      
       $this->load->view('footer', $data);  
  
  }
}
?>

but when i click on edit, there is no admin_car_edit form, so function edit() isnt loading properly and i dont know where is problem, maybe bad hierarchy, but have fast solve this problem ?

Thanks for help.

El Forum

[eluser]MaxEisley[/eluser]
Nobody can help me ?