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

Yii – Sessions

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

Sessions make data accessible across various pages. A session creates a file on the server in a temporary directory where all session variables are stored. This data is available to…

Continue ReadingYii – Sessions