Welcome Guest, Not a member yet? Register   Sign In
Display all controller and method
#1

[eluser]sumit270[/eluser]
Hi,
is it possible to display all the controller and method I have created so far?
i hate to have to go through folder and file to find out where i have created my application.
#2

[eluser]CI_avatar[/eluser]
Codeigniter cant do that. but your PHP Editor (like aptana, dreamweaver) can help you to navigate your files easily.
#3

[eluser]sumit270[/eluser]
No you got me wrong there.
what i meant was like if i go to my site example.com/ci/index.php
i want it to show like /index/

controller
-class
--function
--function
--function
-anotherclass
--function
--function

with links
#4

[eluser]Burak Guzel[/eluser]
- Go through your controllers folder with scandir(), to get a list of the classes.
- Include each controller file.
- For each controller class, use the get_class_methods() function to get a list of their methods.
#5

[eluser]Rahi[/eluser]
Hi,

bclinton's class really did the trick for me. However, I would like to suggest few update for it.

Code:
$classname = ucfirst(substr($filename, 0, strrpos($filename, '.')));
- $controller = new $classname();
- $methods = get_class_methods($controller);

+ //$controller = new $classname();
+ $methods = get_class_methods($classname);

<b>Reasons:</b>

1. There is no need to instantiate the class. We can simply pass class name and it will give us the methods.
2. If controllers are looking for valid sessions, it will keep redirecting you to the login page.
3. In case you are using Matchbox, HMVC, it will not load supporting libraries.

I thought it worth giving my input, but thanks for the kick off.

-Rahi




Theme © iAndrew 2016 - Forum software by © MyBB