D
D
Dmitry2013-09-18 12:50:06
Yii
Dmitry, 2013-09-18 12:50:06

I want to learn Yii, but have questions...?

I have been writing in php for a very long time. Made a bunch of websites, shops, etc. Your own admin. But in general, as it was all bydlokoderstvo, it remains so. Those. Despite the fact that I have done a lot, I do not consider myself a professional programmer. I always worked alone, NOT in the company of my own kind, so there was no one to learn from. Now I no longer want to make websites on my own engine, which has been refined all these years and which, in principle, performs its functions. I don’t want it for the reason that, whatever one may say, it is primitive and “terrible” inside. I want to reach a new level, start writing normal code. Or at least try.
I faced a choice: rewrite my engine, take a ready-made CMS and deal with it, or study some kind of framework. After a long reading of forums, habr, etc., I came to the conclusion that the third option should be considered. Also, after long painful choices, I settled on Yii.
Because Since I have never worked with frameworks, I just can’t put my head down and clearly imagine what a “framework” is. I used to think that this is just a set of ready-made classes, which already contains the solution to many problems that a programmer does not have to solve. Then I learned that a framework is more than just a set of classes. For example, the same Yii, after installation, has a ready-made web application architecture, database, etc. Those. in fact, a ready-made framework, on the basis of which you can write your own.
Question 1. Is the “ready frame” the client part of the site (front end) or the admin panel frame (back end)? Or, initially, the framework is just a ready-made file structure, classes, database, etc., and I have to write the client part and the admin part myself, based on this framework? I'm afraid I'm being very vague. I'm trying to turn all this mess of thoughts in my head into a clear question.
When I, say, write in php from scratch, I create the client side of the site: index.php, template files, classes, database, etc. And I create an admin part, which has its own index, its own templates, etc. In Yii, am I also writing an admin panel from scratch (using framework classes) or does the admin part already exist and I already need to finish it to my needs (implement the appearance and hang my functions)?
Question 2. I will give a simple and stupid example in order to ask a question based on it. Let's say the site has sections: "news", "articles", "events", "questions / answers", etc. I call it all by the common word "lists". Those. each such list has its own table in the database (for example, "articles"). In the admin part of the site, I create a section where the user can "add/edit/delete" elements of this list (articles). The admin part of the site provides a template in which the corresponding form is entered, where “title”, “text”, “author”, etc. are entered. articles (each list has its own set of characteristics). I understand correctly that the process of creating such "lists", i.e. adding new tables (say, there were news and articles on the site, and I also add a list (table) "authors") is it as automated as possible? Or I do it, as now, i.e.
Question 3. How flexible is the framework. I will ask this question on the basis of the previous one. Let's say we have two tables "articles" and "authors". Each article is associated with an author (through an ID in the database). And the customer of the site asks for it to look like this in the admin panel, for example: We go to the “articles” section and first we see the list of authors. Clicked on the author, and got to the page with a list of articles by this author. And already by clicking on a specific article, we proceed to its editing. Such here implementation of administration of articles. And, for example, on another site, another customer wants the scheme to be like this: Go to the admin panel in the "articles" section, see a list of all articles. We entered a specific article and on its editing page there is a drop-down list of authors (who, of course, are taken from the “authors” table) and through this drop-down list we link the article to a specific author. Those. I gave an example of two different options for implementing the functionality. Making a site on my own codes, I can easily implement any approach. Here I am a king and a god. And what about Yii, can I pervert as I please? After all, for example, I work with some well-known CMS system, such things will not work. CMS-ki have a strictly defined functionality. This functionality, of course, is huge, but still driven into some kind of strict framework. And if you want to radically change something, then you need to get into the codes and rewrite. I work with some well-known CMS system, such things will not work. CMS-ki have a strictly defined functionality. This functionality, of course, is huge, but still driven into some kind of strict framework. And if you want to radically change something, then you need to get into the codes and rewrite. I work with some well-known CMS system, such things will not work. CMS-ki have a strictly defined functionality. This functionality, of course, is huge, but still driven into some kind of strict framework. And if you want to radically change something, then you need to get into the codes and rewrite.
Question 4. Some people, discussing the topics of frameworks, on the same hub, for example, often say phrases like: "I tried to make a project on Yii, then I decided to study Kohana and did it on it, and then I did it on Zend ...". Okay, I understand that there are people who are very trainable and they can quickly move from one framework to learning another and do a project on it, but I don’t understand HOW this can be cost-effective ??? After all, it’s not enough to make a website (client part), but now in 90% of cases the site needs an admin panel. Do programmers, so easily, move from one framework to another, just as easily write their admin panel for it? Or, after all, the admin panel has already been developed, say, on one project (framework) and just somehow programmers migrate it to their other projects (on other frameworks), although I don’t understand how this can be. In my opinion, only the presentation (i.e., template sets, appearance) can be transferred from their developments, but all the functionality needs to be re-sharpened based on the new framework. Or am I still missing something...

Answer the question

In order to leave comments, you need to log in

6 answer(s)
M
Max, 2013-09-18
@AloneCoder

It seems to me that first you need to read about OOP in general, and then about MVC so that you can operate with the correct terminology
Now everything is very chaotically stated
You confuse the concepts of framework and CMS
1. Yes, this is just a framework, everything will need to be written from scratch
In yii there is gii is a code generator, it will simplify a lot of routine things
2. Here you are talking about models and inheritance
3. Yii is very flexible
4. Some people do it just for learning. Lack of experience with such tools makes you think of it as something incredible, everything is actually simpler.
Well, then look at www.phptherightway.com/

D
Doktor_Gradus, 2013-09-18
@Doktor_Gradus

1. You write both frontend and backend, but at the same time, Yii has a generator that, based on entities (that is, tables in the database), creates the corresponding controllers, models and views - that is, both the admin part and the client part, and you already finish up to the functionality required by the customer.
2. You create a table in the database, then run the generator and it creates everything you need (see answer 1). Then you make edits.
3. Yes, you can do both. Remove what you don't, add what you need.
4. Often people make everything from ready-made components. There are a lot of bundles for Symfony, a lot of modules for Zend. For Yii, there are also a great many extensions. To use Twitter Bootstrap, there is Yii-Booster and Yii-Bootstrap, there is an extension for authorizing users, in general, there is a lot of ready-made code that allows you to assemble an admin panel and a site from ready-made blocks, something like in a Lego constructor, only there are no longer small bricks, but whole nodes.

A
Artur Bordenyuk, 2013-09-18
@HighQuality

There is no frame for the most part. What we see after webapp is an example of how everything can be implemented.
By and large, the framework is the original folder structure, which can be easily changed if you climb under the hood.
After the webapp, we remove everything from protected/controllers, protected/models, protected/views, protected/dataand ... everything seems to be, but I'm not sure.
And here we have a clean version on which it is worth working further.
How to work? There is no initial separation for the functionality of the front and back ends, but this can be fixed (or come up with / steal your own plan based on the standard modules).
Code generation will work against you until everything the generator generates is crystal clear. When that happens it will be possible to fix generator templates (or add your own) and turn routine things into nothing and do something really cool.
How flexible is the framework? Such examples are easily implemented in any modern framework.
I haven’t heard about ways to migrate code from framework to framework, but someone chooses their favorite by trying each one a little bit.
Yii is a worthy option ... and even more so for rewriting your cms.
Of course, it’s worth studying from the documentation and there will be questions, then immediately to the forum .

M
mihailkog, 2014-01-23
@mihailkog

If you are a beginner, you can read Yii for beginners .

R
Roman Suvorov, 2015-04-04
@barbmitica37

I recommend the book - Yii. Collection of recipes.
Electronically here .
The paper version is here .

K
karser, 2013-09-21
@karser

If you are interested in a really new level - take Symfony2. Understand a serious project and do by analogy.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question