#1 2010-08-10 11:55:05

Registered: 2010-08-08
Posts: 86

Extending the Module-Engine

Hello everyone,

this is not really a suggestion, but I wanted to discuss the module engine of Ionize with you guys.
I've written some test modules yesterday and tried to hook into severel levels of ionize, which is very limited.
So I thought about discussing the abilities of modules and what's missing in your opinion.

First of all, it's a great module logic, you use. Everyone who's familiar with CodeIgniter will love it. It's really easy to build some custom sites, interfaces and contents. But it's also a little bit limited. As soon as you want to hook into Ionize, make some runtime modifications or grab some information, you'll come to its limits.

For example, I tried to make some modifications within the admin interface by writing a module:
1. Provide the ability to create a list of "hidden elements"
2. Store those information
3. Make these elements hidden within the admin interface

Point 1 and 2 work pretty well. But I couldn't interact or modify any default output.
My attempt was to change the route of an existing controller to my module and make some things different. I ould have replaced the method/controller of processing the page-editing-output by just routing the URI to my custom controller. I would have given all the data to the models and libraries, so that everything would have processed correctly, but made some changes in the views output.
In this way, I could provide a default view/controller of Ionize, but modify some things at runtime, like the view's output. By this, I could write modules with the ability to extend for example the admin interface.
Modules would be possible to make default elements invisible, change default elements, change default stylesheets etc.

But there was no way to achieve this.
I've tried to use the routes.php within the module to manipulate the main routes, but after looking into the core, I've seen, that they're handled differently. Then I've set the main URI of the module to an existing one, but then, of course, the existing one was out of order (and I would have needed to replace the whole admin controllers, as I could only replace one route per module).
In this way, I could e.g. replace the complete controllers of the admin menu in order to write a kind of admin-interface-hook-plugin, but it would mean a lot of maintenance mode for every single release. And besides that, I couldn't really communicate with this module out of another module.

To keep a long story short:
The usage of modules is limited to custom CI-like controllers and views. But in order to write more complex modules, that can change Ionize's look and feel, I'd really appreciate to have the ability to go a little deeper. For example manipulating the main routes would be helpful.

What do you think? What would you improve within the module system?


Ps.: It was the first time I used modules. So maybe I just missed something.


#2 2010-08-10 12:00:02

Registered: 2010-08-08
Posts: 86

Re: Extending the Module-Engine


in order to make this thread more readable, I'll write down my first suggestion within a reply (hope you don't mind double posts):
My suggestion would be to provide a file like "hook_routes.php" within the module/config/ directory. Within this file, one can define routes, which are Ionize-wide usable. For example to overwrite existing Ionize routes. All "hook_routes.php" within all modules should be processed, right after application/config/routes.php is processed.



#3 2010-08-10 18:13:32

Ionize Core Team
From: Paris, France
Registered: 2010-03-22
Posts: 927

Re: Extending the Module-Engine

Great suggestion !
Of course for the moment, modules are thinked to provide 2 things :
1. Admin enhancement, but limited to new features (dedicated DB table management, like for the FancyUpload module)
2. User side enhancement, by providing a tool linked to an URL.

As you surely see, both of these usage can be combined.

Your proposal to enhance or replace some of the "core" functionalities is really good, bit is not (again, for the moment) the purpose of the modules.
The basic idea of the upcoming 0.9.6 version is to provide a really flexible core system, wich will be a base for every developer to create web applications.
Of course the core give the main ability to manage a website, but it has to be flexible enough to open to other usages.

Your proposal is quite good, we need to discuss it as soon as I come back from holliday !

Inspiration & Innovation : Websites by Partikule, Agence Web Paris


#4 2010-08-10 18:41:11

Registered: 2010-08-08
Posts: 86

Re: Extending the Module-Engine

Hey there,

after a lot of testing and tricking, I got it working to write 2 modules, which can be used, to hook the admin-interface. One mirrors (symbolic) the whole admin interface to another uri and the other replaces the current admin-uri (domain.com/ionize/admin*). This second one takes every request, checks whether there is any other module, which wants to process the request and redirects it to the third plugin, which can now do whatever it wants. If there's no third plugin, the request will be redirected to the mirrored admin interface and will be processed as usual. So now I can modify every single request and response from and to the admin panel using modules. This is a bit tricky, but it works pretty good :-)

I'll write a demo module, which shows how to use this method and then release it here for some tests. Unfortunately 2 modules, which I wrote today, are mandatory for that. But I'm quite happy now, as I got it managed to do, what I wanted to do:
Modify every request and response at runtime by just using modules and not altering the core.

Gonna upload everything tomorrow. So stay tuned.

Oh, and yes, I'm really looking forward to discussing with you guys.
But enjoy your holiday first!


Last edited by Mario (2010-08-10 18:43:42)


What's Ionize ?

Ionize is an Open Source Content Management System created by webdesigners for webdesigners.

Created and maintained by Partikule and Toopixel, Ionize wants to be the easiest and most powerful CMS.

Can I help ?

Because talent is nothing without involvement, we are looking for motivated coders and webdesigners to join the project team.


Website : ionizecms.com
Documentation : doc.ionizecms.com

Development : Ionize on GitHub
Translations : Ionize Translations