Welcome Guest, Not a member yet? Register   Sign In
Codeigniter HMVC how to list all modules
#1

[eluser]alikhan88[/eluser]
Hi

I want to know that how can i list all of the module names and under each module name list of all controllers and under each controller list of all the public method names.






Thanks in advance for the help
#2

[eluser]alikhan88[/eluser]
Hi Guys,

No one is there to help me in this regard. I need this type of implementation to get dynamic list of all modules present and all controllers present under each module and all methods present under each controller. So i don't know much , that's why i require help.




Thanks again
#3

[eluser]CroNiX[/eluser]
Not sure why you'd need to do something like that, but you'd have to do that all manually.
1) Cycle through your modules dir and get filenames
2) Cycle through each modules controllers dir and get controller file name
3) Use the ReflectionClass to get the methods of each controller
#4

[eluser]ivantcholakov[/eluser]
@CroNiX

About 3) The Reflection approach.

All the controller definitions are going to be loaded in memory.

There is a probability controllers classes with same names to be tried to be parsed by PHP - this will cause an error.

-----------------------

A library that parses the syntax of the php files to extract class names and public method names is another possible way for 3).

This is an extraordinary task.
#5

[eluser]CroNiX[/eluser]
I can see that as a possibility since he's using HMVC. I use the reflection class to get all methods of my /libraries and /models to automatically generate a file containing all of the declarations so that intellisense works for CI in my IDE for all of my custom code, so that's what I thought of first. If he uses unique controller/model/library names for each module it would most likely work ok.




Theme © iAndrew 2016 - Forum software by © MyBB