HMVC Current module name |
[eluser]emateu[/eluser]
Hi, I'm working with hmvc. I need to get the current module name... For example, if I'm in: http://localhost/index.php/mymodulename/controller/method. I would like to get mymodulename string from any class, controller, library or whatever. Doing: Code: $RTR =& load_class('Router', 'core'); Code: $RTR->fetch_class(); Code: $RTR->fetch_method(); Regards!
[eluser]PhilTem[/eluser]
Why do you load the router class? You can get the module's name easily via Code: $this->_module = $this->router->fetch_module(); though I haven't tried the second one
[eluser]emateu[/eluser]
This don't work: Code: $this->router->fetch_module(); It give me the name of the module where I execute the line. I want to get the module of the query string! Thanks
[eluser]PhilTem[/eluser]
Well.... That should actually be the same (if you're calling the all properly). Either I didn't get what you were wanting go get or you don't know what you want to get or explained what you want to get properly.
[eluser]emateu[/eluser]
Okay, here I go: Two files: A) application/modules/emateu/controllers/emateu.php Code: class Emateu extends MX_Controller { B) application/modules/helloworld/controllers/helloworld.php Code: class Helloworld extends MX_Controller { So, when I request: http://localhost/index.php/helloworld/helloworld/index , I'm getting "emateu" as result and I expect to get "helloworld" because I'm on: http://localhost/index.php/helloworld/helloworld/index. I said that is not working like fetch_class() or fetch_method() because when request: http://localhost/index.php/helloworld/helloworld/test I'm getting "helloworld - test" instead of "emateu - get_class_method" and thats okay, but fetch_module() is not working like that and I would like to have a similar criteria if its possible. I hope I have explained. Thanks! |
Welcome Guest, Not a member yet? Register Sign In |