🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

The Solution: Part 2

posted in Rarely Spoken
Published May 28, 2005
Advertisement
I decided to try to force each module to implement a very specifically named class with some very specifically named members. The name of the class is based on the file name that the module is defined in: admin.php's class name is admin_interface, cudb.php's class name is cudb_interface. Each class must have at least these four functions: Install(), Uninstall(), GetContent(), and Administrate().

ExtractFunctions() has become GetModuleInterface() and now returns the name of the module's class. I discovered that PHP allows you to instantiate that class like so

$class_name = GetModuleInterface();$instance = new $class_name;


I like this solution a lot better because now I dont need that ugly Function field in my database like I had before, I dont have call_user_function() or an ugly array of functions in my code like I did when I returned an array of functions, and generally it seems like the code is simpler.

Before I decided to try this I tried to take jumpjumpjump up on his suggestion to look at MediaWiki's namespaces but I guess I suck at PHP or I dont get MediaWiki's code because I didnt understand what was going on. I looked in a few files but I didnt find one that included Namespace.php nor did I understand the significance of Namespace.php. [oh]
Previous Entry The Solution
Next Entry Paging Owns Me
0 likes 2 comments

Comments

Rob Loach
As far as I know, MediaWiki just uses a : to determine what namespace the requested query is part of. For example:
Toys:Dildo
In this example, Dildo would belong to the Toys namespace. I don't know much about MediaWiki, but I do have it installed on my server.

e107 uses arrays with everything. This way, if you want to make a module, you just add what you want to the end of the array you have to deal with. It also uses a database table to determine what modules are installed along with all its settings. Ummmm, do you want a copy of rWeb? It was a horrible website template system I made a while ago and have just recently decided not to maintain it anymore. You want a copy of it? Here's an example page along with the stylesheet changer. I'm going to delete it soon anyway due to its horribleness [smile].
May 28, 2005 07:29 AM
Colin Jeanne
Thanks for the links. I have a copy of rWeb but I dont know how recent it is. It looks like it's from November. If you have a more recent version I'll be happy to see it (part of the reason I started on this project was rWeb [grin]).

I'll go digging in MediaWiki some more as well.
May 28, 2005 01:29 PM
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Advertisement

Latest Entries

4E6 PyGame

1382 views

4E5

1116 views

Happy Yesterday!

1071 views

Another Game

1278 views

Merry Christmas!

1052 views

Hello There

1051 views

Yay!

1066 views
Advertisement