示例#1
0
$form = ActiveForm::begin(['enableClientValidation' => false]);
$categories = Category::getCategories();
$items = ArrayHelper::map($categories, 'id', 'name');
$tab1 = $form->field($model, 'category_id')->dropDownList($items);
$tab1 .= $form->field($model, 'title')->textInput();
$slug = Html::tag('span', rtrim(Yii::$app->request->getHostInfo(), '/') . '/', ['class' => 'input-group-addon']);
$slugTemplate = "{label}\n<div class=\"input-group\">{$slug}{input}</div>\n{hint}\n{error}";
$tab1 .= $form->field($model, 'slug', ['template' => $slugTemplate])->textInput();
$tab1 .= MarkdownEditor::widget(['model' => $model, 'attribute' => 'content']);
$tab2 = $form->field($model, 'meta_title')->textInput();
$tab2 .= $form->field($model, 'meta_description')->textInput();
$tab2 .= $form->field($model, 'meta_keywords')->textInput();
$tab3 = '<div class="form-group field-article-author">
<label for="article-author" class="control-label">作者</label>
<p class="form-control-static">' . Html::encode($model->user->email) . '</p></div>';
$tab3 .= '<div class="form-group field-article-created-at">
<label for="article-created-at" class="control-label">创建时间</label>
<p class="form-control-static">' . $model->created_at . ' (' . Str::friendlyDate($model->created_at) . ')</p></div>';
$tab3 .= '<div class="form-group field-article-updated-at">
<label for="article-updated-at" class="control-label">更新时间</label>
<p class="form-control-static">' . $model->created_at . ' (' . Str::friendlyDate($model->updated_at) . ')</p></div>';
echo Tabs::widget(['items' => [['label' => '主要内容', 'options' => ['style' => 'padding:1em;'], 'content' => $tab1, 'active' => true], ['label' => 'SEO', 'content' => $tab2, 'options' => ['style' => 'padding:1em;']], ['label' => '文章相关信息', 'content' => $tab3, 'options' => ['style' => 'padding:1em;']]]]);
echo Html::a('重 置', ['update', 'id' => $model->id], ['class' => 'btn btn-default']);
?>

<?php 
echo Html::submitButton('提 交', ['class' => 'btn btn-success']);
?>

<?php 
ActiveForm::end();
示例#2
0
                    <a class="pull-left" href="#">
                        <?php 
    $img = $comment->user ? $comment->user->portraitSmall : '';
    $email = $comment->user ? $comment->user->email : '';
    ?>
                        <img class="media-object img-thumbnail" width="64" height="64" src="<?php 
    echo $img;
    ?>
" alt="头像(小)">
                    </a>
                    <div class="media-body well well-sm">
                        <h5 class="media-heading"><?php 
    echo $email;
    ?>
                            <small class="pull-right">发表于:<?php 
    echo Str::friendlyDate($comment->created_at);
    ?>
</small>
                        </h5>
                        <?php 
    echo Html::encode($comment->content);
    ?>
                    </div>
                </li>
<?php 
}
?>
            </ul>
<?php 
if (Yii::$app->session->hasFlash('comment_message')) {
    ?>
示例#3
0
">
                        <i class="glyphicon glyphicon-share" style="font-size:0.5em;margin-right:1em;"></i>
                    </a>
                </h2>
                <p>
<?php 
    $html = Markdown::process($article->content, 'gfm');
    echo Str::closeTags(Str::limit($html, 200));
    ?>
                </p>
                <p>
                    <i class="glyphicon glyphicon-calendar"></i><span><?php 
    echo $article->created_at;
    ?>
(<?php 
    echo Str::friendlyDate($article->created_at);
    ?>
)</span>
                    <a target="_blank" href="<?php 
    echo Url::to(['site/view', 'slug' => $article->slug]);
    ?>
#comments">
                        <i class="glyphicon glyphicon-share" style="font-size:0.5em;"></i>
                    </a>
                    <a href="<?php 
    echo Url::to(['site/view', 'slug' => $article->slug]);
    ?>
#comments"
                       class="btn btn-default btn-xs" style="margin-top:-2px;"
                       role="button">评论(<?php 
    echo $article->comments_count;