shiyang / yii2-masonry
Masonry Yii2 Extension width infinitescroll
Installs: 449
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 2
Forks: 4
Open Issues: 1
Type:yii2-extension
Requires
- bower-asset/imagesloaded: *
- bower-asset/masonry: ^3.2
- shiyang/yii2-infinite-scroll: *
- yiisoft/yii2: *
This package is not auto-updated.
Last update: 2025-09-27 22:07:15 UTC
README
Masonry Yii2 Extension width infinitescroll
Installation
The preferred way to install this extension is through composer.
Either run
php composer.phar require --prefer-dist shiyang/yii2-masonry "*"
or add
"shiyang/yii2-masonry": "*"
to the require section of your composer.json
file.
Usage
Once the extension is installed, simply use it in your code by :
Controller action:
function actionIndex()
{
$query = Article::find()->where(['status' => 1]);
$countQuery = clone $query;
$pages = new Pagination(['totalCount' => $countQuery->count()]);
$models = $query->offset($pages->offset)
->limit($pages->limit)
->all();
return $this->render('index', [
'models' => $models,
'pages' => $pages,
]);
}
View:
\shiyang\masonry\Masonry::begin([
'options' => [
'id' => 'models'
],
'pagination' => $pages
]);
foreach ($models as $model) {
// display $model here
}
\shiyang\masonry\Masonry::end();