05-15-2009, 11:16 PM
|
#1 (permalink)
|
|
The Contributor
Join Date: Feb 2007
Posts: 64
Thanks: 9
|
Using Interfaces
This is something I have yet to touch on, interfaces and abstract classes, and need a bit of help using them. I understand their purpose and logic ( I think ).
I am working on a project that will allow users to buy addons for their website. This website is hosted and maintained by me, but it allows them to manage the data ( they can choose features they want, the template that is installed, etc ).
This is all ran on a component layer so I can easily add these features once they've paid for them ( and there will occasionally be some freebies ).
For the sake of leaving things open for development later ( maybe I will find the need to hire someone to help add new stuff ), I have decided that the component classes should follow a suit. The main admin index checks the required class file, auto instantiates the class ( if defined to do so ), passing important vars to the constructor and calling the performer method. It has a few other required things as well soon that will be sent around to other classes for stats and other things ( again, leaving it open, haven't implemented that yet ).
Basically, what I think I want to use for this is an interface. I have a seperate file for all interfaces ( components, plugins, and a few other things ). I have required the interface class, and in my component, component IMPLEMENTS interface_name.
What I am getting now is an error : interface components not found in file.php. Is there a special way to do this? Does the interface have to exist int he same file, or does it need to be called? I checked the manual, but their examples reside in the same file, which doesn't seem logical in my situation ( because I would have to repeat it over and over ).
|
|
|
|