Hello! I am a beginner, so the question below can be a little silly, but I will forgive you if you know. Imagine a psd layout ... How to approach the creation of MVC on the site (any site). How to understand how many controllers to create? Need to start creating a link structure ??? In general, where to start creating a site? Or does it all start with database design? Thank! PS I did not know which section to write in, so I wrote here ... And if you can ... a link to articles with the creation of the site architecture (taking into account the psd layout)
- I climbed into Google to find what MVC is, and immediately got a link to Habré (second): habrahabr.ru/post/181772 Can help - VostokSisters
1 answer
This question is not entirely in the SO format, since the answer cannot be unambiguous, only the recommendations:
In general, where to start creating a site?
I understand that if you decided to take MVC as a basis, then take the framework with MVC, and install its start-application. For example on Zend 3: https://framework.zend.com/downloads/skeleton-app . Earned? Hurray, the beginning of the site! And then we will roll out some common useful modules for your framework (for example, Zend modules ). Everything is working? Krutyak, 80% have already been done.
Or does it all start with database design?
The structure of the database is created gradually for startups. There is no way that once and did the final version of the database. BUT just before any code associated with the data - first comes the database structure.
How to understand how many controllers to create?
A controller is the mental separation of one logic from another. Their number depends on how diverse the logic is on your portal.
For example - you decided to write an ad module in your MVC. Usually, two controllers are made at the beginning — IndexController, which groups the actions for displaying different lists of ads in different places, and OfferController — containing actions for working with one advertisement (for example, profile, editing, deleting), but there can be one controller — if the plan is completely short (supplementary). Or maybe you had a module, and you want to add more functionality to work with photos in it - then you start another PhotoController (provided that Photo is not available as a module). Or there may be 15 controllers in a module - if the religion of the lead developer so desires, or if the module is large.
Gradualism: it was usually so in my experience that a basic “naked” version of the project was made to demonstrate to the customer that the money was spent correctly. And then the project is overlaid with different modules, controllers, and other things - the complexity goes on gradually. Do not strive to immediately make the final version of their ideas, iteration - power.
- For example ... I already have a classic-style curb site (this is where there are several superimposed pages in the heap, in different folders and sql). Next we do the MVC framework or use the framework right away. And then the engine ... And what to do with multilingualism (although already at the end ...) This is some confusion in the head. After all, there is an order for any website building, be it a News portal or an online store ... - Alexey87K
- @ Alexey87K - the fact that you have a coherent website, this is a “layout” - that is, a set of pages. If there is no dynamic functionality, you can limit yourself to pages, if you accept duplicate code. Whether to take a framework depends on the goal, without a frame it makes sense to write only if the goal is self-study. Multilingual is done by means of any frame. If your site is a business card site, then frameworks are not needed there, because the server code is a few lines. Everybody has their own order - but, as a rule, everyone starts by taking something familiar (and already written) as a basis. - Goncharov Alexander
- But what is the Yii framework? Often hear about it. How about makes life easier? And, if I'm going to stretch the layout on Wordpress, should it be used, or are these not comparable things and does WP have its own framework replacing Yii? I'm new and trying to figure it out! Thank you - Aleksey87K
- @ Alexey87K Wordpress is a CMS. With CMS, you can also create websites - but there is more managerial work than programmer work there. And Yii is a framework (skeleton), of course the frame will not work with CMS only if the CMS itself is not written on the frame. The difference between CMS and frame - CMS you just need to install, install plugins - and everything works, programming is not necessary. Minus - limited capabilities, often - slows down, scales - often badly. Framework - everything is written independently. Cons - write a lot for yourself, a long study - to be able to do qualitatively. - Goncharov Alexander
- @ Aleksey87K often take CMS as a basis for a project, and write a plugin for it, according to the specifics of the project. For example, in Russia, they do this with Bitrix, forgive me - Goncharov Alexander