algolteam / library-yii2
这是 Yii2 工具库。
2.0
2022-08-30 08:11 UTC
Requires
- php: >=7.4
- algolteam/library: *
- yiisoft/yii2: *
README
这是 Yii2 工具库。
需求
- PHP >= 7.4
- PHP7 的 Curl 扩展必须启用。
下载
使用 Composer
在项目目录中运行
composer require algolteam/library-yii2
或者
php composer.phar require algolteam/library-yii2
注意:如果您没有 Composer,可以在此 下载。
使用发布存档
https://github.com/algolteam/yii2-utility/releases
使用 Git
在项目目录中运行
git clone https://github.com/algolteam/yii2-utility.git
使用方法
<main.php>
<?= GridView::widget([ 'dataProvider' => $dataProvider, 'columns' => [ [ 'class' => ALGOL_YII::GridColumnExpandOf(), 'attribute' => 'fTitle', 'label' => 'Title', 'onclick' => function ($data) { $FResult = []; if (isset($data['fUrl']) and !empty($data['fUrl'])) { $FResult['value'] = '<i class="fa fa-youtube-play"></i> ' . $data['fTitle']; $FResult['url'] = \yii\helpers\Url::toRoute('info'); } else { $FResult['value'] = '<i class="fas fa-folder"></i> ' . $data['fTitle']; $FResult['url'] = yii\helpers\Url::home(); $FResult['expand'] = false; } $FResult['data'] = ['id' => $data['ID'], 'hi' => [1, 2, 3]]; return $FResult; }, ], ], ]) ?>
<controller.php>
<?php public function actionInfo($id = null) { if (isset($id)) { $model = Tlink::findOne($id); if (isset($model)) return $this->renderAjax('info', ['model' => $model]); } return 'not found data...'; } ?>
<view.info.php>
<?php use yii\widgets\Pjax; ?> <?php Pjax::begin([]); $info = ALGOL::EmbedOf()->get($model->fUrl); ?> <div class="container-fluid"> <div class="row"> <div class="col-3"> <img class="img-fluid img-responsive rounded shadow" src="<?= $info->image ?>"> </div> <div class="col p-3"> <div class="list-group list-group-horizontal pb-3 text-center"> <a href="<?= $info->authorUrl ?>" class="list-group-item list-group-item-action bg-opacity-75 bg-dark text-white"> <h5 class="mb-1"><i class="bi bi-play-btn"></i> Play</h5> </a> <a href="<?= $info->authorUrl ?>" class="list-group-item list-group-item-action bg-opacity-75 bg-dark text-white"> <h5 class="mb-1"><i class="bi bi-youtube"></i> YouTube</h5> </a> <a href="<?= $info->authorUrl ?>" class="list-group-item list-group-item-action bg-opacity-75 bg-dark text-white"> <h5 class="mb-1"><i class="bi bi-heart"></i> Favorite</h5> </a> <a href="<?= $info->authorUrl ?>" class="list-group-item list-group-item-action bg-opacity-75 bg-dark text-white"> <h5 class="mb-1"><i class="bi bi-stars"></i> List</h5> </a> </div> <h5><?= $info->title ?></h5> <p class="text-justify"><?= ALGOL::StrOf()->Replace($info->description, [CH_NEW_LINE, CH_TRIM], [CH_FREE]) ?></p> </div> </div> </div> <?php Pjax::end(); ?>
许可证
此开源软件根据 BSD-3-Clause 许可证分发。请参阅 LICENSE.md。
贡献
欢迎各种贡献 - 代码、测试、文档、错误报告、新功能等...
- 发送反馈。
- 提交错误报告。
- 编写/编辑文档。
- 修复错误或添加新功能。
联系我
您可以通过 Telegram 联系我,但如果您有问题请 打开一个。
支持我
或者使用 Paypal 购买我一些啤酒。