mirror of
https://github.com/yiisoft/yii2.git
synced 2025-08-26 06:15:19 +08:00
Global DOCS update: ~~~ replaced with ```
This commit is contained in:
@ -22,7 +22,7 @@ use yii\di\Instance;
|
||||
*
|
||||
* The following is an example of using ActiveDataProvider to provide ActiveRecord instances:
|
||||
*
|
||||
* ~~~
|
||||
* ```php
|
||||
* $provider = new ActiveDataProvider([
|
||||
* 'query' => Post::find(),
|
||||
* 'pagination' => [
|
||||
@ -32,12 +32,12 @@ use yii\di\Instance;
|
||||
*
|
||||
* // get the posts in the current page
|
||||
* $posts = $provider->getModels();
|
||||
* ~~~
|
||||
* ```
|
||||
*
|
||||
* And the following example shows how to use ActiveDataProvider without ActiveRecord:
|
||||
*
|
||||
* ~~~
|
||||
* $query = new Query;
|
||||
* ```php
|
||||
* $query = new Query();
|
||||
* $provider = new ActiveDataProvider([
|
||||
* 'query' => $query->from('post'),
|
||||
* 'pagination' => [
|
||||
@ -47,7 +47,7 @@ use yii\di\Instance;
|
||||
*
|
||||
* // get the posts in the current page
|
||||
* $posts = $provider->getModels();
|
||||
* ~~~
|
||||
* ```
|
||||
*
|
||||
* @author Qiang Xue <qiang.xue@gmail.com>
|
||||
* @since 2.0
|
||||
|
@ -26,7 +26,7 @@ use yii\web\Request;
|
||||
*
|
||||
* Controller action:
|
||||
*
|
||||
* ~~~
|
||||
* ```php
|
||||
* function actionIndex()
|
||||
* {
|
||||
* $query = Article::find()->where(['status' => 1]);
|
||||
@ -41,11 +41,11 @@ use yii\web\Request;
|
||||
* 'pages' => $pages,
|
||||
* ]);
|
||||
* }
|
||||
* ~~~
|
||||
* ```
|
||||
*
|
||||
* View:
|
||||
*
|
||||
* ~~~
|
||||
* ```php
|
||||
* foreach ($models as $model) {
|
||||
* // display $model here
|
||||
* }
|
||||
@ -54,7 +54,7 @@ use yii\web\Request;
|
||||
* echo LinkPager::widget([
|
||||
* 'pagination' => $pages,
|
||||
* ]);
|
||||
* ~~~
|
||||
* ```
|
||||
*
|
||||
* @property integer $limit The limit of the data. This may be used to set the LIMIT value for a SQL statement
|
||||
* for fetching the current page of data. Note that if the page size is infinite, a value -1 will be returned.
|
||||
|
@ -25,7 +25,7 @@ use yii\di\Instance;
|
||||
*
|
||||
* SqlDataProvider may be used in the following way:
|
||||
*
|
||||
* ~~~
|
||||
* ```php
|
||||
* $count = Yii::$app->db->createCommand('
|
||||
* SELECT COUNT(*) FROM user WHERE status=:status
|
||||
* ', [':status' => 1])->queryScalar();
|
||||
@ -52,7 +52,7 @@ use yii\di\Instance;
|
||||
*
|
||||
* // get the user records in the current page
|
||||
* $models = $dataProvider->getModels();
|
||||
* ~~~
|
||||
* ```
|
||||
*
|
||||
* Note: if you want to use the pagination feature, you must configure the [[totalCount]] property
|
||||
* to be the total number of rows (without pagination). And if you want to use the sorting feature,
|
||||
|
Reference in New Issue
Block a user