PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
I have a content management system that I've been working on for the last few weeks and have run into an issue that I can't seem to figure out. What I would like is to be able to use classes as "modules" that could be activated or deactivated. Those classes would be listed in database form and then called in series. The problem that I've run into is that I can't seem to find anything other than call_user_func as a way of instantiating the objects. Here is an exmple of what I would like to accomplish:
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
That code should work with the parens. The reason you get an error with call_user_func() is that you are calling the class statically -- not calling a method in an instance. What version of PHP are you using? Can you give us the exact error message or what "won't work" means?