luyadev / luya-module-gallery
画廊模块允许您创建文件夹和集合,并将图片上传到集合中。这是一种快速创建画廊并创建您自己的视图文件的方法。
1.0.2
2019-08-22 11:34 UTC
This package is auto-updated.
Last update: 2024-09-05 15:03:35 UTC
README
画廊模块
画廊模块允许您创建文件夹和集合,并将图片上传到集合中。这是一种快速创建画廊并创建您自己的视图文件的方法。
安装
模块安装需要Composer。
composer require luyadev/luya-module-gallery
配置
通过Composer安装后,在配置文件中的模块部分包含该模块。
'modules' => [ // ... 'gallery' => [ 'class' => 'luya\gallery\frontend\Module', 'useAppViewPath' => false, // When enabled the views will be looked up in the @app/views folder, otherwise the views shipped with the module will be used. ], 'galleryadmin' => 'luya\gallery\admin\Module', ]
初始化
安装和配置成功后,运行迁移、导入和设置命令以初始化项目中的模块。
1.) 迁移您的数据库。
./vendor/bin/luya migrate
2.) 将模块和迁移导入到您的LUYA项目中。
./vendor/bin/luya import
视图文件
由于模块未附带默认视图文件,您可以使用以下示例
cat/index.php
<?php foreach($catData as $item): ?> <div class="well"> <h1><?= $item->title; ?></h1> <a href="<?= $item->detailLink; ?>">Alben anzeigen</a> </div> <?php endforeach; ?>
alben/index.php
<table border="1"> <?php foreach($albenData as $item): ?> <tr> <td><img src="<?= Yii::$app->storage->getImage($item->cover_image_id)->applyFilter('medium-thumbnail')->source; ?>" border="0" /></td> <td> <h2><?= $item->title; ?></h2> <p><?= $item->description; ?></p> <p><?= $item->detailLink; ?></p> </td> </tr> <?php endforeach; ?> </table>
album/index.php
<table border="1"> <tr> <td> <h2><?= $model->title; ?></h2> <p><?= $model->description; ?></p> <p><a href="<?= $model->detailLink; ?>"><?= $model->detailLink; ?></a> <h3>Bilder</h3> <div class="row"> <?php foreach($model->albumImages as $image): ?> <div class="col-md-3"> <img class="img-responsive" src="<?= $image->getImage()->source; ?>" border="0" /> </div> <?php endforeach; ?> </div> </td> </tr> </table>