[eluser]deineMudder[/eluser]
Hello i am still a newbie to CI and have a basic question again.
I got my Controller User:
Code:
<?php
class User extends Controller {
function User()
{
parent::Controller();
if ($this->session->userdata('logged_in') != TRUE){
redirect('/admin/login/','location');
}
}
function activation()
{
$controller = 'user';
$data['page_vars'] = $this->libadmin->page_vars($controller);
...
}
function add()
{
$controller = 'user';
$data['page_vars'] = $this->libadmin->page_vars($controller);
...
}
function search()
{
$controller = 'user';
$data['page_vars'] = $this->libadmin->page_vars($controller);
...
}
....
...
..
.
In order to define some variables im passing the controller to a library to return the variables i want. Now i want to reduce my code a bit and was thinking that i could put the 2 first lines of each function in the controller somewhere into a global variable but it seems im unable to do it
i wanted it to look like this:
Code:
<?php
class User extends Controller {
function User()
{
parent::Controller();
$controller = 'user';
$data['page_vars'] = $this->libadmin->page_vars($controller);
if ($this->session->userdata('logged_in') != TRUE){
redirect('/admin/login/','location');
}
}
function activation()
{
i wanna be able to access $controller here....
}
anyone got an idea on how to solve it?