We have written a pretty complex web application which has following requirements:
One way to organize this stuff I was thinking of is extending the Kohana HMVC cascading style to a level more. For example:
src/
htdocs/
v1/
device_group_phone/
device_iphone/
controllers/
views/
device_android/
controllers/
views/
device_default/
conrollers/
views/
device_group_tablet/
device_ipad/
controllers/
views/
device_default/
conrollers/
views/
device_group_default/
controllers/
views/
models/
v2/
...
...
...
modules/
system/
The way a request should be served is:
- Go to proper version.
- if there is a controller/view device(x),
then load it.
else, if there exists a controller/view for device_group(x)/device_default,
then load it.
else if there exists a controller/view for device_group_default
then load it.
Why dont use existing Kohana Cascade Filesystem? Your groups are modules, just add modules you need (via Kohana::modules()
) based on Request properties. So, if you need to handle android device, module list would be like this: