\Fuel::add_module("module");
\Module\Class::method();
\Config::load('module::configfile');
[music] |__ like.php (class Controller_Music_Like extends Controller_Like) |__ tag.php (class Controller_Music_Tag extends Controller_tag) music.php like.php tag.php
// Tags.php abstract class Tags { public function do() {} } // Controller.php... class Controller_Something extends \Controller implements Tags {}
Frank Bardon wrote on Wednesday 11th of May 2011:Would you be able to use an abstract class and implement them in each controller?
// Tags.php abstract class Tags { public function do() {} } // Controller.php... class Controller_Something extends \Controller implements Tags {}
Then you have to implement (write or copy) the code in each class that implements the interface. Theres no 'parent' or shared logic. Shared features sounds to me more like models/classes than controllers.Object interfaces allow you to create code which specifies which methods a class must implement, without having to define how these methods are handled.
Frank Bardon wrote on Thursday 12th of May 2011:Well, maybe there's a better solution... but here's something I did in my models. I created a Tagable interface and a Tag class. In my models I put a few methods with some basic functionality. Each model knew if it could take one or several tags, ... Inside of the interface functions I use the Tag class methods... I guess I could just make the Tag class more dynamic, perhaps just use the table name as the ... but it definitely worked. I just kind of used the interface as a way to standardize the tag implementation across multiple models.
It looks like you're new here. If you want to get involved, click one of these buttons!