0

I've been searching for a good architecture models for some time. I think that in a good application should have controllers and modules which should be repeatable parts on different pages. For example a shopping cart - if you are working on an online store you would need it on almost every page.

Also another requirement for me is that it should support changing styles (themes|skins) of the website easily - which can be achieved by deciding the style in two parts - views and assets (css, images, javascript). Which means that all the views should be located on one place, not like in Modular Extension.

And finally it's directory structure should look like this:

    application/
    ├────controllers/
    |       ├────home.php
    |       └────products.php
    ├────modules/
    |       └────shopping-cart.php
    └────views/
            └────style_blue/
                    ├────home.php
                    ├────products.php
                    └────modules/
                            └────shopping-cart.php
    assets/
    └────style_blue/
            ├────css/
            |     └────style.css
            ├────js/
            |     └────jquery.js
            └────images/
                  └────header.png

This is the perfect architecture isn't it?

  • It can be extended with new modules and controllers.
  • It can have different styles (skins|themes)
  • It is pretty simple and in the same time functional

I am a big fan of CodeIgniter and I want to achieve something like that with it. Is there an add-on which could work for me?

Itay Grudev
  • 7,055
  • 4
  • 54
  • 86
  • in your example, modules also should have controller,views, assets folder and a dependency script to tell what other modules this modules depends upon. – iamgopal Apr 25 '12 at 08:25
  • No, well to use new styles easily and efficiently all the views and etc should be in the style directory. Take a look. The shopping-cart's view is in /application/views/style_blue/modules/ – Itay Grudev Apr 25 '12 at 08:33
  • if everything goes in to the same directory, How will you create separation ? How will form.css from app will differ from form.css from module ? – iamgopal Apr 25 '12 at 08:34
  • You won't need it to. So there isn't a way to do something like my architecture, is that true? – Itay Grudev Apr 25 '12 at 08:47

1 Answers1

1

You could check http://www.getsparks.org for some add-ons.

I believe this is what you need for your custom styles: http://getsparks.org/packages/template/versions/HEAD/show

It can handle multiple themes according to the description. Furthermore this library is very handy. (I am using it, just didn't use the theme part yet).

Furthermore, for modules maybe this is what you need? https://bitbucket.org/wiredesignz/codeigniter-modular-extensions-hmvc/wiki/Home

P.T.
  • 3,130
  • 4
  • 19
  • 24