Welcome Guest, Not a member yet? Register   Sign In
creating a cms need help
#1

[eluser]UdayD[/eluser]
hi!
i am developing a cms through CI.I want to separate my administrator from the front end.
i wrote a controller administrator
and wrote another config variable as

Code:
$config['admin_url']    = "http://example.com/Administrator";

and i acccess the controller for it using the url
Code:
http://example.com/Administrator/login

the controller for it as below
Code:
class Administrator extends Controller {

    function Administrator ()
    {
        $this->base=$this->config->item('admin_url'); //this is line 7 m getting error here.
        $this->css=$this->base.$this->config->item('cpstyle');//style for my administrator views
    }
   function login()
   {
   $data['css'] = $this->css;
   $data['base'] = $this->base;
   //$this->load->view('Administrator/',$data); // i have added a folder inside a view as administrator and want to access views inside that folder.
   }    
    
}
I am surely doing something wrong as i am getting an error
Code:
A PHP Error was encountered

Severity: Notice

Message: Undefined property: Administrator::$config

Filename: controllers/administrator.php

Line Number: 7

Please tell me how can i do this, i.e seperate my admin and the frontpanel.
Thanks in Advance
#2

[eluser]pickupman[/eluser]
You should be using the url http://example.com/administrator/login (lowercase url's). You may also want to look into what routes can do.
#3

[eluser]UdayD[/eluser]
even if i use url in lower case still i get the same error. I think there something wrong with the code of config vars.
#4

[eluser]Ngua Go[/eluser]
What's $this->config->item('cpstyle') ?
not exist $config['cpstyle']
#5

[eluser]UdayD[/eluser]
its my administrators views css!
#6

[eluser]pickupman[/eluser]
Should be this:
Code:
class Administrator extends Controller {

    function Administrator ()
    {
        parent::Controller(); //Need this line to inherit the Controller class
        $this->base=$this->config->item('admin_url'); //this is line 7 m getting error here.
        $this->css=$this->base.$this->config->item('cpstyle');//style for my administrator views
    }
   function login()
   {
   $data['css'] = $this->css;
   $data['base'] = $this->base;
   //$this->load->view('Administrator/',$data); // i have added a folder inside a view as administrator and want to access views inside that folder.
   }    
    
}
#7

[eluser]Unknown[/eluser]
i have used this code and it is working properly now




Theme © iAndrew 2016 - Forum software by © MyBB