Swiper demo

Last stand-alone version of MS-DOS

ID240
Date1994/06/15
DescriptionVersion 6.22
Symbolfad fa-terminal

This is a demonstration of Yii2-swiper for the Yii framework 2.0. It allows the user to move to neighbouring records by means of clicking, touch swiping, or using the left and right arrow keys.

<?php
use sjaakp\swiper\PrevNextBehavior;

class Event extends \yii\db\ActiveRecord
{
    public static function tableName()
    {
        return 'event';
    }

    public function behaviors()
    {
      return [
        [
            'class' => PrevNextBehavior::class,
            'attribute' => 'date',
        ]
        //
      ];
    }
    // ...
}
<?php
use yii\widgets\DetailView;
use sjaakp\swiper\Swiper;
?>
...
<?= Swiper::widget([
    'model' => $model,
    'labelAttribute' => 'title',
    'shortLabelAttribute' => 'date',
    'titleAttribute' => 'description',
    'url' => 'swiper',
]) ?>
...
<?= DetailView::widget([
    'model' => $model,
    'attributes' => [
        'id',
        // ...
    ],
])
...
?>