Yii – Data Widgets
Yii provides a set of widgets for displaying data. You can use the DetailView widget to display a single record. The ListView widget, as well as Grid View, can be…
Yii provides a set of widgets for displaying data. You can use the DetailView widget to display a single record. The ListView widget, as well as Grid View, can be…
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…
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…
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…
When you have too much data to display on a single page, you should display it on multiple pages. This is also known as pagination. To show pagination in action,…
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…
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…
Cookies allow data to be persisted across requests. In PHP, you may access them through the $_COOKIE variable. Yii represents cookie as an object of the yii\web\Cookie class. In this chapter, we describe several…
Cookies are plain text files stored on the client side. You can use them for tracking purpose. There are three steps to identify a returning user − Server sends a…
Yii provides a concept of flash data. Flash data is a session data which − Is set in one request.Will only be available on the next request.Will be automatically deleted…