sangroya / yii2-detailview
使用 bootstrap 类增强 yii2 框架的 DetailView 小部件
dev-main
2020-12-13 16:46 UTC
Requires
- yiisoft/yii2: ~2.0.0
This package is auto-updated.
Last update: 2024-09-14 01:19:43 UTC
README
使用 bootstrap 类增强 yii2 框架的 DetailView 小部件
安装
安装此扩展的首选方式是通过 composer。
运行以下命令之一:
php composer.phar require --prefer-dist sangroya/yii2-detailview "*"
或将其添加到您的 composer.json
文件的 require 部分:
"sangroya/yii2-detailview": "*"
to the require section of your composer.json
file.
用法
扩展安装后,只需在您的代码中使用它即可
<?= echo \sangroya\DetailView::widget([ * 'model' => $model, * 'attributes' => [ ['group'=>true,'label'=>'Personal Detail'] * 'title', // title attribute (in plain text) * 'description:html', // description attribute in HTML * [ // the owner name of the model * 'label' => 'Owner', * 'value' => $model->owner->name, * ], * 'created_at:datetime', // creation date formatted as datetime * ], 'header'=>false //by default it's true and set the header on the top * ]); ?>```