Welcome Guest, Not a member yet? Register   Sign In
can't send parameter to admin function
#1

hi all, I'am very new with CI,

I try to set up CI with Bootstrap themplate, and admin, bootstrap front page works fine and I set up admin page to, but couldn't figure out to change pages in admin theme, I know it's sounds confiused but please try to help me understand this.

here is what I have router page
PHP Code:
$route['(:any)'] = 'pages/view/$1';
$route['default_controller'] = 'pages/view';
$route['404_override'] = '';

$route['admin/(:any)'] ='admin/admin_pages/$1';
$route['admin'] = 'admin/admin_pages'

and this is my admin_pages class

PHP Code:
if ( ! defined('BASEPATH')) exit('No direct script access allowed');

    Class 
Admin_pages extends CI_Controller{
    
       public function 
__construct(){
       
            
parent::__construct();
            
// Your own constructor code  
            
       
}
    
        public function 
index(){
        
            
$this->admin_pages();
        
        }
        
        
        public function 
admin_pages($admin_page 'dashboard'){
        
        if(!
file_exists('application/views/admin/ad_pages/'.$admin_page.'.php')) {
        
            
show_404();
        
        }

            
$data['title'] = $admin_page;
            
$this->load->view('admin/ad_template/ad_header',$data);
            
$this->load->view('admin/ad_template/ad_nav');
            
$this->load->view('admin/ad_pages/'.$admin_page,$data);
            
$this->load->view('admin/ad_template/ad_footer');
        } 
    
    } 

and this my pages class

PHP Code:
if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class 
Pages extends CI_Controller {
    
    public function 
index() {
 
       
## call the pages dynamicly
       
$this->view(); 
        
    }
    
    
    public function 
view($page "home") {
    
        
$this->load->helper('url');
        
$base_url base_url();
        if(!
file_exists('application/views/pages/'.$page.'.php')) {
        
            
show_404();
        
        }
      
        
## this gives the title to every page with 
        ## ucfirst() this makes firts letter big 
        
$data['title'] = ucfirst($page); 

        
$this->load->view('templates/header',$data);
        
$this->load->view('templates/nav');
        
$this->load->view('pages/'.$page,$data);
        
$this->load->view('templates/footer');
    
    }
   
    


I'am working on localhost and all my codes is inside the folder codeIgniter

now when I write in url
Code:
http://localhost/codeIgniter/

It's opening the home page,it's ok, fine, and if I change url to this

Code:
http://localhost/codeIgniter/about

this works too.

if I want to go to admin page I do this

Code:
http://localhost/codeIgniter/admin/

this opens the admin page dashboard

if I want to change this to tables

Code:
http://localhost/codeIgniter/admin/tables

this give me error "page not found"

but if I change in admin_pages method'2 parameter to tables this works.

question is why I can't send parameter to my admin_pages method
Reply


Messages In This Thread
can't send parameter to admin function - by valencia - 12-16-2014, 06:48 AM



Theme © iAndrew 2016 - Forum software by © MyBB