denar90/yii2-lazy-loading-module
Composer 安装命令:
composer require denar90/yii2-lazy-loading-module
包简介
Yii2 module for content lazy loading
关键字:
README 文档
README
Yii2 module for content lazy loading
Main features:
- showing items mode. Probability to use both in backend and in frontend
- flexible module configuration
Installation
The preferred way to install this extension is through composer.
- Either run
php composer.phar require --prefer-dist "denar90/yii2-lazy-loading-module": "dev-master"
or add
"denar90/yii2-lazy-loading-module": "dev-master"
to the require section of your application's composer.json file.
- Add a new module in
modulessection of your application's configuration file, for example:
'modules' => [ 'lazyloading' => [ 'class' => 'denar90\lazyloading\LazyLoading', 'modelNamespace' => '\app\models\Items' \\ your model with items ], ],
This configuration will show only list, without links on each item. Mode by default is 'list'.
- Mode 'view' configurations, for example:
'modules' => [ 'lazyloading' => [ 'class' => 'denar90\lazyloading\LazyLoading', 'modelNamespace' => '\app\models\Items', \\ your model with items 'mode' => 'edit', 'additionalLinks' => [ 'view' => [ 'controller' => 'yourController', 'action' => 'yourViewAction' ] ] ], ],
- Mode 'edit' configurations, for example:
'modules' => [ 'lazyloading' => [ 'class' => 'denar90\lazyloading\LazyLoading', 'modelNamespace' => '\app\models\Items', \\ your model with items 'mode' => 'edit', 'additionalLinks' => [ 'view' => [ 'controller' => 'yourController', 'action' => 'yourViewAction' ], 'delete' => [ 'controller' => 'yourController', 'action' => 'yourDeleteItemAction' ] ] ], ],
Usage
In your action call module
For example:
... public function actionIndex() { $lazyLoading = Yii::$app->getModule('lazyloading'); return $lazyLoading->runAction('lazyloading/index'); } ...
Also you should create method in your model for getting list of items. For example:
namespace app\models\Items; ... public function getAllItems($limit = 10, $offset = 0) { return $this->find()->offset($offset)->limit($limit)->all(); } ...
统计信息
- 总下载量: 139
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-01-02