I
I
Ivan Karabadzhak2014-01-14 17:50:30
Yii
Ivan Karabadzhak, 2014-01-14 17:50:30

What to read about designing a web application for MVC?

I am writing now in Yii and I try to make applications in such a way that I would not be ashamed myself and the code would be more universal in order to use it again in the future.
Here is a banal example. There is a small website (10 pages + news section + feedback forms).
It is clear with the models - a static page model and a news model, a model for validating the link form. Or you can use a universal model where you can specify the page type (news or static). Views are also understandable - depending on the design of the pages.
But what about controllers? Make controllers for each entity? Let's say a news controller with read, list actions. And the actions for creating news and editing (control panel) add to it or create another controller for the entire control panel?
It just raises a bunch of questions, what controllers to create, how to name the methods. I solve them, but I constantly feel a lack of knowledge.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander Makarov, 2014-01-14
@Jakeroid

Make controllers for each entity?

In your case, yes.
If editing in the frontend, you can in the same. If it is a separate panel like Wordpress, take it to a module or a separate application.

S
Sergey, 2014-01-14
Protko @Fesor

Perhaps start with the documentation for YII.
In general, one action should do only one thing. Moreover, I recommend immediately dividing the functionality into modules. For the admin panel, yes, you need a separate controller, since there are access filters, user rights are different ...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question