Independent MVC structure... need an advice
I'm tired of looking after a frame work for mvc implementation. i want to build a good MVC based structure of my own that will serve me in my projects. so here is my thinking I'd like to know what do you think. first of all. here is the folder 开发者_JS百科structure:
The folder structure
the Admin and the Site folders:
I assume that the controllers/views in the admin/site and are totally different one from each other, so it is necessary that they will be in independent in each folder. if the autoload in the admin or site folder will not find a view/controller in its folder he will look for it in the MVC folder
the model, which is the db layer can be inside the MVC folder because it is shared to the entire project. a function like get_article_by_id can be used in the site and in the admin as well.
the MVC folder:
will hold the entire project models. and shared controllers/views.
the classes folder:
will be use as a framework folder, it will hold classes such as mailer,db that will implement php functions
How does that sound to you?
Part of the benefit of using a popular framework is that other people know it and can help you with it. If you write your own, only you know about it. There is an MVC framework in almost every language and lots of thought has gone into each one, which means you get the benefit of a lot of experience by selecting an existing one, rather than writing your own.
As long as you feel convenient with this structure - use it.
If you need to ask advice about whether your reinvention of the wheel is any good then it's probably not better then the wheels already in existence.
A wheel inventor that knows he has a better wheel wont need to ask advice.
精彩评论