views:

33

answers:

1

If I'm going about this the wrong way, please let me know and I'll accept that as a potential answer.

I have a Zend Framework MVC app that is modular, and in one of the modules the site acts very similar to a static HTML site:

Category1_Controller
    Category1_Subpage_Action1
    Category1_Subpage_Action2
    Category1_Subpage_Action2
Category2_Controller
    Category2_Subpage_Action1
    Category2_Subpage_Action2
Category3_Controller
    Category3_Subpage_Action1
    Category3_Subpage_Action2
    Category3_Subpage_Action2

Etc.. To save time, I'd like to make a function that grabs the current controller, then all of the actions associated with the controller, and create a dynamic navigation based on those two variables (ul/li list to be styled globally). Creating the actual navigation is not a problem, but how do I get all of the actions based on a controller within a module? Is that even possible?

Thanks a ton!

+2  A: 

You can use the php function get_class_methods to retrieve all the methods from a controller, then check each method to see if it ends with 'Action'.

Alternatively you could use ReflectionClass, but it's probably overkill here.

David Caunt