views:

451

answers:

2

Hello,

the idea

I'm playing with a concept of modular website builder - now mostly in theory, which would containt pages / collections based on modules (either preprogrammed or done specifically when needed).

Every module with come with it's ties to DB, views/templates and core data processing, I'm thinking about factory pattern:

basic module wrapper - having normalized names -> callDB, processData, returnToTemplate

each module then inherits this wrapper and just adds it's calls to DB, it's data processing and finally will return to data, then in application, I will just do something like:

$this->modules->each->callDB(); //obviously, pseudo-PHP

the problem

What am I struggling with, however, is incorporating this whole idea into CodeIgniter's MVC approach and it's data structure, so it won't be/feel (i know, subjective) unnatural and/or meaningless.

Any ideas?

(under tree structre i - i know, that i can do whatever i like. However, I don't know if I like dir modules with subir for each module, or templates in application/templates and modules in application/modules - and those modules, it actually doesn't make sense to me, since my modules are somewhat different than CI modules... you know...)

edit1

So... is this so hardcore or so dumb that there are no answers??

+2  A: 

What exactly are you trying to achieve? There is plenty of code out there to help you achieve modular architecture (HMVC) in your CodeIgniter application.

Modular Separation - wiredesignz

Matchbox - Zacharias Knudsen

Anything else you need to add in relating to wrapping the module is purely in the implementation. I'd look into using MY_Controller and possibly taking it a step further to implement multiple base classes, so your frontend controllers know to wrap the module with whatever data from the DB.

Phil Sturgeon
main SO's CI advisor, Phil? :)
Adam Kiss
I am the unofficial StackOverflow CodeIgniter guy :-p
Phil Sturgeon
Seems ok, I'll go with it :]
Adam Kiss
A: 

There is a HMVC extension to codeigniter, check http://codeigniter.com/wiki/Modular_Extensions_-_HMVC/

Also you cand separate concerns in a modular way, by overloading CI's loader class (and routing if needed) and storing your MVC files in subfolders of application/models, application/views and application/controllers

Benoit
Phil Sturgeon
Phil, there is. people who use PHP4 could use ME.
Thorpe Obazee
@Thorpe: true about PHP4, however not my need :]
Adam Kiss
You are fortunate :]
Thorpe Obazee