Welcome Guest, Not a member yet? Register   Sign In
Grabing Class and function name for use in a libraries
#1

[eluser]The Casual Bot[/eluser]
hi all,

im trying to make a auth libary that will allow and diallow access the controller and function

so i trying to get the class and function name and the easy way i could think of doing this was the uri class but this seems to just return '0'

any ideas / suggestions how i can do this

i now i can pass the name in a var but want to try to avoid that
#2

[eluser]WanWizard[/eluser]
You mean the controller and method called thru the URI?

Code:
$controller = $this->uri->rsegment(1);
$method = $this->uri->rsegment(2);

Or in case you're intrested in the URI before routing

Code:
$controller = $this->uri->segment(1);
$method = $this->uri->segment(2);
#3

[eluser]The Casual Bot[/eluser]
yeah kinda got this to work

that is what i was doing

but i had the following

Code:
$CI->load->library('uri');

clearly i didnt read the user guide as it seems by calling the class it stop it from be called

once this line was removed it started to work fine
#4

[eluser]The Casual Bot[/eluser]
but thanks

anyway


Big Grin
#5

[eluser]danmontgomery[/eluser]
Code:
$this->router->class;
$this->router->method;




Theme © iAndrew 2016 - Forum software by © MyBB