Welcome Guest, Not a member yet? Register   Sign In
Way to get current object and method by URI?
#1

[eluser]ShoeLace1291[/eluser]
I'm looking for a function that would tell me the current object and method by way of the URI. Normally, I would use $this->uri->uri_string(), however, I do not want to pass any "dynamic" segments. For example, a URI of 'products/shoes/123', would be 'products/view_product'.

I want to be able to do this so I can create a config file containing page titles... since I use a model to output my page header. It is called from MY_Controller.php in the construct. For example: $this->template->overall_header($title = "View Product")... but in the construct, it would be $this->template->overall_header($title = $this->config->item($object_method_string));

Anybody have any solutions? Thanks for your time.
#2

[eluser]Pert[/eluser]
Something like this maybe?

http://stackoverflow.com/questions/21159...ion-in-php

#3

[eluser]CroNiX[/eluser]
Code:
global $RTR;
echo $RTR->fetch_class();
echo $RTR->fetch_method();
echo $RTR->fetch_directory();
$RTR is the router object which is automatically instantiated in CodeIgniter.php as part of the bootstrap process. If you declare it global, you can use it in your controllers, etc.




Theme © iAndrew 2016 - Forum software by © MyBB