Yii – Data Providers

  • Post author:
  • Post category:Yii
  • Post comments:1 Comment

Yii provides a set of data provider classes that encapsulate pagination and sorting. A data provider implements yii\data\DataProviderInterface. It supports retrieving sorted and paginated data. Data providers usually work with…

Continue ReadingYii – Data Providers

Yii – Properties

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

Class member variables in PHP are also called properties. They represent the state of class instance. Yii introduces a class called yii\base\Object. It supports defining properties via getter or setter class methods. A getter method starts…

Continue ReadingYii – Properties

Yii – Sorting

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

When displaying lots of data, we often need to sort the data. Yii uses an yii\data\Sort object to represent a sorting schema. To show sorting in action, we need data. Preparing the…

Continue ReadingYii – Sorting

Yii – Formatting

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

To display data in a readable format, you can use the formatter application component. Step1 − Add the actionFormatter method to the SiteController. public function actionFormatter(){ return $this->render('formatter'); } In the above code, we just render…

Continue ReadingYii – Formatting

Yii – Files Upload

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

You can easily implement a file uploading function with the help of yii\web\UploadedFile, models and yii\widgets\ActiveForm. Create a directory ‘uploads’ in the root folder. This directory will hold all of the uploaded images. To upload…

Continue ReadingYii – Files Upload