本文整理汇总了PHP中app\models\Authors::getNameAuthor方法的典型用法代码示例。如果您正苦于以下问题:PHP Authors::getNameAuthor方法的具体用法?PHP Authors::getNameAuthor怎么用?PHP Authors::getNameAuthor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\models\Authors
的用法示例。
在下文中一共展示了Authors::getNameAuthor方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: function
?>
<div class="books-index">
<h1><?php
echo Html::encode($this->title);
?>
</h1>
<?php
echo $this->render('_search', ['model' => $searchModel]);
?>
<?php
echo GridView::widget(['dataProvider' => $dataProvider, 'columns' => ['id', 'name', ['attribute' => 'preview', 'content' => function ($model, $key, $index, $column) {
if (!empty($model->preview)) {
return Html::a('<img src="img/' . $model->preview . '" style="max-width: 100px; max-height: 100px;">', 'img/' . $model->preview, ['class' => 'view_image']);
} else {
return NULL;
}
}], ['attribute' => 'author_id', 'value' => function ($data) {
return Authors::getNameAuthor($data->id);
}], 'date', 'date_create', ['class' => 'yii\\grid\\ActionColumn', 'template' => '{edit} {view} {delete}', 'buttons' => ['edit' => function ($url, $data) {
Url::remember(Url::current());
return Html::a('<span class="glyphicon glyphicon-pencil"></span>', Url::toRoute(['/books/update', 'id' => $data->id]), ['target' => '_blank']);
}, 'view' => function ($url, $data) {
return Html::a('<span class="glyphicon glyphicon-eye-open"></span>', Url::toRoute(['/books/view', 'id' => $data->id]), ['class' => 'fancybox.ajax', 'id' => 'view_modal']);
}, 'delete' => function ($url, $data) {
return Html::a('<span class="glyphicon glyphicon-trash"></span>', Url::toRoute(['/books/delete', 'id' => $data->id]), ['data-confirm' => Yii::t('app', 'Вы действительно хотите удалить эту книгу?')]);
}]]]]);
?>
</div>
示例2:
<?php
use yii\helpers\Html;
use yii\widgets\DetailView;
use app\models\Authors;
/* @var $this yii\web\View */
/* @var $model app\models\Books */
$this->title = $model->name;
$this->params['breadcrumbs'][] = ['label' => 'Books', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="books-view">
<h1><?php
echo Html::encode($this->title);
?>
</h1>
<?php
echo DetailView::widget(['model' => $model, 'attributes' => ['id', 'name', 'date_create', 'date_update', ['attribute' => 'preview', 'value' => 'img/' . $model->preview, 'format' => ['image', ['width' => '100']]], 'date', ['attribute' => 'author_id', 'value' => Authors::getNameAuthor($model->id)]]]);
?>
</div>