Yii – Layouts

  • Post author:
  • Post category:Yii
  • Post comments:0 Comments

Layouts represent the common parts of multiple views i.e. for example, page header and footer. By default, layouts should be stored in the views/layouts folder. Let us have a look at the…

Continue ReadingYii – Layouts

Yii – Views

  • Post author:
  • Post category:Yii
  • Post comments:0 Comments

Views are responsible for presenting the data to end users. In web applications, Views are just PHP script files containing HTML and PHP code. Creating Views Step 1 − Let us have a…

Continue ReadingYii – Views

Yii – Modules

  • Post author:
  • Post category:Yii
  • Post comments:0 Comments

A module is an entity that has its own models, views, controllers, and possibly other modules. It is practically an application inside the application. Step 1 − Create a folder called modules inside…

Continue ReadingYii – Modules

Yii – Widgets

  • Post author:
  • Post category:Yii
  • Post comments:0 Comments

A widget is a reusable client-side code, which contains HTML, CSS, and JS. This code includes minimal logic and is wrapped in a yii\base\Widget object. We can easily insert and apply this…

Continue ReadingYii – Widgets

Yii – Models

  • Post author:
  • Post category:Yii
  • Post comments:0 Comments

Models are objects representing business logic and rules. To create a model, you should extend the yii\base\Model class or its subclasses. Attributes Attributes represent the business data. They can be accessed like…

Continue ReadingYii – Models

Yii – Using Controllers

  • Post author:
  • Post category:Yii
  • Post comments:0 Comments

Controllers in web applications should extend from yii\web\Controller or its child classes. In console applications, they should extend from yii\console\Controller or its child classes. Let us create an example controller in the controllers folder.…

Continue ReadingYii – Using Controllers