Hi Simon,
Thanks for the reply. I think you got the essence of what I am trying to do
and surely helped.

I use the term module because my application is, well, made from several
separate modules :)  For example, a blog module, a news module, a survey
module etc. Every module has at least one but sometimes more controllers and
all the models, views that it requires to work.

The default module would have the basic elements needed by all other
modules, for example, helper classes.

So theoretically in order to enable a new client I would create the client's
directory, populate with a xml or ini with the settings and that's it.

If this client has a unique feature it would be located locally (within it's
directory) and if it needs a different version of a standard module (my blog
system needs to also do this....) it would as your example shows extends the
standard controller (or model) class and provide it's implementation.

In my example, my blog module I'd have
blog/application/controllers/IndexController.php
blog/application/controllers/AdminController.php
blog/application/models/Blog.php
blog/application/models/BlogDb.php
blog/application/views/scripts/ (all the phtml)
blog/html/js/
blog/html/css/blog.css
blog/setup/config.ini (settings like how many posts to fetch, if I need to
be registered to comment and so on)

In order to have the clientX use this module simply create
/clientX/blog/setup/config.ini

If I i'd like to change the looks create a
/clientX/blog/html/css/blog.css

And/or create and copy the phtml I'd like to alter.
/clientX/blog/application/views/scripts/index/view.phtml

If i'd like to change the behavior create
/clientX/blog/application/controllers/IndexController.php (which extends the
original controller)
/clientX/blog/application/models/Blog.php (which extends the original model)

The tricky part seems to be:
a)  within the bootstrap that would receive something like
clientX/module/controller/action, find if there is a local implementation (a
file_exists of
/path/clientX/module/application/controllers/<controller>.php) use it
otherwise call
/path/myapplication/module/application/controllers/<controller>.php.
b) In each controller that needs to find out if there is a local view and
properly set the path from where it should load and refer to (the url of the
css, js used from the view)

As you mentioned the models would not perform any kind of path-finding.  If
I have a local Controller (extended from the 'base' one) I need to tell
which model I'd like to use with the proper
require('clientX/blog/application/models/Blog.php') instead of
require('blog/application/models/Blog.php').

But I think that the controller has to do something at least to find out if
it should load the phtml from the base views/scripts directory or the local
one. Don't you think?

thanks.



On Sun, Mar 2, 2008 at 1:48 AM, Simon Mundy <[EMAIL PROTECTED]>
wrote:

> I'm not sure if your use of the term 'module' was intended, but did you
> mean 'controller'? I say that because I've used a similar strategy when
> creating a multi-client portal and I had each of my clients' divided by
> module.
>

Reply via email to