Welcome Guest, Not a member yet? Register   Sign In
Modular Extensions - Version 4.3

[eluser]pengekcs[/eluser]
My modules (kcs_captcha_module - available on wiki, just updated it) stopped working when I upgraded from 4.1.11 to 4.1.20. This is the second time something that breaks the whole thing happens. As it's a community project - and I do like it in some ways - I have tracked down the bug to my module ending in a return 'some value'; whilst the modules::run method has been changed to do output buffering between the versions. So I just needed to echo 'some value' instead of returning it.

Would have been good if you mentioned it somewhere on the forums, wiredezigz Wink - FYI I update your HMVC wiki to reflect this.

- Also, would not it be possible to use MY_Controller.php instead of completely replacing the CI original with a Controller.php ? In case of a session module it is fine, but your code seems to be doing some 'magic' in there...

- While I am also here, is it possible / recommended at all to have multiple controllers in a module? Right now afaik if I have a module named: 'something', then it will look for this at:
/modules/something/controllers/something.php

And I can access it from a view or controller by calling modules::run('something', 'some value passed', 'function_name');

If I have a /modules/something/controllers/an_other_thing.php - How can I call / run it?

- What is the autoload functionality you mentioned a few pages before that you've added doing? How can we use it?

In the end it would be good if CI would build in a similar functionality that your code provides. I find it really easy to just drop in some modules that I made and have them working promptly Wink

So keep up the good work! (but also, please, please keep the wiki updated if you have a chance - without that it makes some of us frustrated and wasting time trying to figure out what to do, and how)

[eluser]wiredesignz[/eluser]
Thanks for updating the wiki, this being a community project means your contribution is welcome too.

Yes it is possible to use more than one controller per module, simply use the module name as a prefix segment.

ie: modules::run('module/controller', $data, 'method')

Autoload uses module/config/autoload.php, and works the same as CI autoload for the module.

[eluser]wiredesignz[/eluser]
Modular Extensions Version 4.2.01 is available on the wiki now.

Refactored the code to give ME4.2 (PHP4) almost equivalent functionality to ME5.0 (PHP5)

Note* $autoload['controllers']; is now replaced with $autoload['modules'];

As always, feedback is appreciated.

[eluser]wiredesignz[/eluser]
Some features in Modular Extensions include:

All controllers can contain an $autoload class variable, which holds an array of items to load prior to running the constructor. This can be used instead of module/config/autoload.php, however using the file takes precedence over the class variable.

Modules::run() output is buffered, so any data returned or output directly from the controller is caught and returned to the caller. In particular, $this->load->view() can be used as you would in a normal controller, without the need for return.

Controllers can be loaded as class variables of other controllers using $this->load->module('module/controller'); or simply
$this->load->module('module'); if the controller name matches the module name.

Any loaded module controller can then be used like a library, ie: $this->module_controller->do_stuff(), but it has access to its own models and libraries independently from the caller.

Module controllers can have independent methods, located in a module/methods directory, these methods act as libraries extending their parent controller and have access to the parent controller features.

Loading a method is achieved from a module controller by using $this->load->method('method'); or from a view by using modules:run(), if the method name is not defined in the controller then the method subclass will be loaded and its own index() method will be called, however if the controller actually has the method, it will be called as normal.

Controllers also have a instance() method that can be used instead of get_instance() in libraries and helpers etc.
ie: $ci = controller::instance();

Of course all module controllers are accessible from the URL via module/controller/method or simply module/method if the module and controller names match.

However if you add the _remap() method to your controllers you can prevent unwanted access to them and redirect or flag an error as you like.

There are probably features that I have forgotten to mention, but I hope this sparks some interest.

[eluser]codex[/eluser]
@ wiredesignz:

Maybe you should extend this information to the Wiki. I think the info there is not up to date and I feel it's better to have all info regarding ME in one spot, not scattered around a 47-page forum topic.

Also in general, what I *personally* would like to see is a faq section for each extension/plugin/hook/whatever. Just take questions you already have answered in the forum and put them as a question/answer combo in the wiki. The more info you give users, the less you have to spend time answering questions.

ME is a wonderful tool, but I think due to the limited (or at least fragmented) documentation people tend not to use it (and go for Matchbox instead).

[eluser]wiredesignz[/eluser]
Thnaks codex,

I'm terrible at writing stuff like this, I just had a quiet moment available to myself to be able to write the previous post and that took me an hour.

I have asked a couple of ME users to contribute some documentation, and you are welcome to help out if you wish.

I can add the above post to the wiki, but it will probably not make a lot of sense with the other stuff there.

EDIT:
I don't think the latest version of ME resembles the version 47 pages ago anyway. :lol:

[eluser]wiredesignz[/eluser]
Wiki is updated. Copy and paste is wonderful.

[eluser]codex[/eluser]
[quote author="wiredesignz" date="1215626026"]
I have asked a couple of ME users to contribute some documentation, and you are welcome to help out if you wish.
[/quote]
Well, to be honest I myself have abandoned ME for Matchbox (I feel bad for admitting). Matchbox is just a bit easier to grasp/implement. But now there's a job ahead in which ME fits the bill better, so I'm looking into using ME again. So maybe this time I *can* contribute.

The addition in the Wiki is not exactly what I had hoped for, but at least it's up to date. Thanks :coolsmirk:

[eluser]wiredesignz[/eluser]
You can use Modular Extensions in exactly the same fashion as Matchbox, without using any of the additional features ME provides.

[eluser]a&w[/eluser]
From the camps of those intimidated by lack of (current) documentation...

One thing that would be a good selling point is some docs for "How to convert your existing matchbox app to a ME app in 5 minutes/steps or less". Maybe I'm ignorant but the salesman makes it sound that easy. ;-)




Theme © iAndrew 2016 - Forum software by © MyBB