Welcome Guest, Not a member yet? Register   Sign In
Adding admin area
#1

Hi,

I created the frontend of my app and now I'd like to create an admin dashboard.

I created an Admin.php controller with the following content:


PHP Code:
<?php

class Admin extends CI_Controller
{
 
     public function view($page 'dashboard')
 
     {
 
           if(!file_exists(APPPATH 'views/admin/' $page '.php')) {
 
                 show_404();
 
           }

 
           
            $data
['title'] = ucfirst($page);

 
           $this->load->view('templates/back/admin_header');
 
           $this->load->view('admin/' $page$data);
 
           $this->load->view('templates/back/admin_footer');
 
     }



I created  dashboard.php in views/admin

but I cannot access the page. If i try to access it like this: http://localhost:8080/ci/admin/view/dashboard
then it's ok, but I'd like to access the admin dashboard like this: http://localhost:8080/ci/admin/

I guess my route is incorrect, I used this:


PHP Code:
$route['admin'] = 'admin/dashboard'

i'm new to CI and I'm just tinkering with it to learn, but I can't figure this out. Any help is appreciated.
Thanks
Reply


Messages In This Thread
Adding admin area - by TamasD - 07-12-2018, 02:20 PM
RE: Adding admin area - by php_rocs - 07-12-2018, 03:15 PM
RE: Adding admin area - by TamasD - 07-12-2018, 09:12 PM
RE: Adding admin area - by salain - 07-12-2018, 10:53 PM
RE: Adding admin area - by enlivenapp - 07-13-2018, 07:12 AM
RE: Adding admin area - by TamasD - 07-13-2018, 08:50 AM



Theme © iAndrew 2016 - Forum software by © MyBB