[eluser]bluecarrot16[/eluser]
Hello –
I'm no stranger to web development (started out with ASP.NET, recently moved to PHP), but I've just discovered CodeIgniter, and I'm really impressed. Reading through the documentation, everything just looked like it made sense (ie: I could see how I would use this). However, as I've started to implement my application, I've encountered some difficulties understanding how CodeIgniter deals with non-singleton classes.
For example, say I was building a portal/CMS application. Each page in the CMS could have some number of "modules." There could be, for instance, a base class "Module" which different types of modules (ie: Blogs, Forums, Polls, etc.) could extend. These extended classes would inherit or extend functions from the base Module class (methods for viewing and editing the module, methods for calculating permissions on the module, etc.) Then, in the model and/or controller, instances of these subclasses could represent the different modules on a given page.
Now, I understand how I could write the Module class, and the subclasses, then get those classes to utilize CodeIgniter (ie: using the getInstance method to grab a CodeIgniter object, etc.) What I'm struggling with is how exactly the Module class and its subclasses (which could each be instantiated multiple times) could be loaded into a CI model or controller. CI has all kinds of rich utilities for loading singleton classes (Models, Controllers, Libraries, each are "classes," but each of these classes is intended to be instantiated only once and to be used for the duration of the request). However, there doesn't really seem to be a way to just load a plain-old-non-singleton class.
Could somebody explain the "CodeIgniter way" of doing this?
Thanks so much.