Welcome Guest, Not a member yet? Register   Sign In
I need a working structure for fast development
#1

[eluser]cayasso[/eluser]
Hi CI community, I am trying to build an application structure in CI that can help me speedup my development, the idea I am having is this:

I would like my application structure to facilitate my life as a developer by only having to dump modules in the modules folder every time I have to create a new project. The idea is to have a repository that contain all these common modules ready to be used whenever a new application is needed to build. I also would like to have a very nice control panel as back-end for applications owners to be able to add content in a very quick way.

application
|_views
template
|_default
|_layout
|_header.php
|_footer.php
|_dark_green
|_layout
|_header.php
|_footer.php
|_modules
|_pages
|_controllers
|_models
|_views
|_news
|_controllers
|_models
|_views
|_articles
|_controllers
|_models
|_views
|_ads
|_controllers
|_models
|_views
|_blog
|_controllers
|_models
|_views
|_gallery
|_controllers
|_models
|_views

I would like with the structure to be able to handle each modulo totaly independant so it can be easy to remove or add.
My idea is that each module should have they own admin back-end so when adding a new module it will be reflected in back-end by get added automaticaly in control panel, each module would have a standard style that could be defined from a DB.

I need to know if this is the best way to do this, and if my idea is to off. In order to use this structure I would also need to have different tables in my DataBase corresponding to each module but if I do this they may be a lot of redundancy in my DB and in my code this because for example Pages, News and Articles handle almost the same data(entry, date, title, post date, active, etc) plus all my controllers and models would have the same code.

I also thought that Pages, News and Articles can be handled in 3 tables. Pages(all page elements only), Entries(text, titles, etc) and Categories(type of entry, news, articles, etc) so I can manage 3 or many different types of pages(modules) with just those 3 tables and I wouldnt need to have one table for each module.

Another idea I had but it seems the less wanted approach is to have a module with a God controller called page that handles the category, page and entries and just send the data to the corresponding view for output to user.

I been looking for the best approach but I am just stuck and not sure how I can get the major benefit out of CI, my DB and modules. I just want a functional structure.

That is why I decided to ask for help and orientation from the best of the best the, CI community!!!!.

Please help me out here pointing me to the right direction :|

Thank you a lot in advance.

Jonathan
#2

[eluser]Phil Sturgeon[/eluser]
You have some good ideas, just finished working on something almost exactly how you described.

http://demo.styledna.net

That's only v0.6, just tagged v0.7 the other day but not uploaded it yet. The modules are entirely self-contained and admin navigation is dynamically created from the modules. Got a helper to do is_module('news') checks too.

Theme support was added in v0.7 and it has its own settings GUI too.

Let me know what you think.
#3

[eluser]xwero[/eluser]
I put reusable files in the system directory as i use one CI base for multiple applications.
#4

[eluser]phpwebdev[/eluser]
Where i can download this source
http://demo.styledna.net


Or Not available yet ?

Regards
#5

[eluser]cayasso[/eluser]
thepyromaniac, thank you for replying

I checked your CMS, it is fantastic, that is exactly the way I need my application to work, how did you manage all of that?

How did you structure your database, did you create one table per module or just uses some tables that control all of this.

What about the controller that handles the modules(header, body, footer), are you using a library to control this?.

Do you have a link to your source?

xwero
for the moment I am not going for multiple applications, I think that would be the next step when all of this is done!! Smile so I thanks for the advise.


Thank you!!

Jonathan
#6

[eluser]cayasso[/eluser]
Hi thepyromaniac, any suggestion on this, do you have your code posted somewhere.

I have come to a conclusion, there are only two ways to do this:

OPTION 1 - Have a library that will integrate all the different page components, navigation, breadcrumbs, content, footer, header, etc.

Drawbacks
1 - This library would need to connect to the DB which would break the MVC concept
2 - If I use a model for the library to connect to I will have a library totally depending on that module.

Advantage
- Each controller in modules will just call the library and this will just create the page and send the output to templates(page view). I am using the template library suggested in the wiki where you can define regions and you can just fill them out with data almost from any place.

OPTION 2

Have a God controller that handle the construction of the page, this controller would be a base controller and the other controllers in the modules will extend from this base controller, this way they would kept the base controller methods. for example articles

class Articles extends BaseController{}

Drawbacks
1 - Any controller inside module will need to include this controller from the main application controllers folder. This doesnt look like a very clean coding.
2 - I would also need to have a models out of the modules that going to be used by the BaseController to get data from the DB.

Advantages
1 - Each controllers from module will only need to extend to this BaseController and walla!! almost everything would be done to create the new page.

About my DATA BASE
I think the best option is to have a Page table, a content table and a category table the content table would have a column called module that will store the module name, so basically each content would be specific to a module and also specific to a category and to a page.

I am still looking for the best approach and it seems very hard to decide which one or maybe there is a total different way to accomplish what I am trying to do.

Any help is appreciated!!!




Theme © iAndrew 2016 - Forum software by © MyBB