当前位置: 首页>>代码示例>>PHP>>正文


PHP ListView::begin方法代码示例

本文整理汇总了PHP中yii\widgets\ListView::begin方法的典型用法代码示例。如果您正苦于以下问题:PHP ListView::begin方法的具体用法?PHP ListView::begin怎么用?PHP ListView::begin使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在yii\widgets\ListView的用法示例。


在下文中一共展示了ListView::begin方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: function

$widget = ListView::begin(['dataProvider' => $dataProvider, 'summary' => '', 'itemOptions' => ['class' => 'item'], 'itemView' => function ($model, $key, $index, $widget) {
    $link = TranslitWidget::widget(['link' => str_replace(' ', '_', trim($model['name']))]) . '-' . $model['id'];
    $abrvBody = strlen($model['about']) > 300 ? substr($model['about'], 0, 300) . '...' : $model['about'];
    $content = '<div class="row events">
                                    <div class="col-md-6">
                                        <div class="thumb">
                                            <a href="' . \yii\helpers\Url::base() . '/trainings/' . $link . '">
                                                <img src="' . Image::getEventPhoto($model['id']) . '" alt="">
                                            </a>
                                        </div>
                                    </div>
                                    <div class="col-md-6">
                                        <div class="text">

                                            <div class="event-header">
                                                <span>' . $model['date'] . '</span>
                                                <h1>
                                                <a href="' . \yii\helpers\Url::base() . '/trainings/' . $link . '">
                                                ' . $model['name'] . '
                                                </a>
                                                </h1>
                                                <!-- <div class="data-tags">
                                                    <a href="#">Technology</a>
                                                </div> -->
                                            </div>

                                            <div class="event-body">
                                                <p>' . $abrvBody . '</p>
                                            </div>

                                            <div class="event-vanue">
                                                <table>
                                                    <tr>
                                                        <td><p class="color">Дата:</p></td>
                                                        <td><p><i class="fa fa-calendar-o"></i>' . $model['created_at'] . '</p></td>
                                                    </tr>
                                                    <tr>
                                                        <td><p class="color">Адрес:</p></td>
                                                        <td><p>' . $model['address'] . '</p></td>
                                                    </tr>
                                                     <tr>
                                                        <td><p class="color">Цена:</p></td>
                                                        <td><p>' . $model['price'] . ' грн.</p></td>
                                                    </tr>
                                                </table>
                                            </div>
                                            <!-- <div class="event-footer">
                                                <a href="' . \yii\helpers\Url::base() . '/trainings/' . $link . '" class="btn-style">Подробнее</a>
                                            </div> -->

                                        </div>
                                    </div>
                                </div>
                                <div class="gap"></div>';
    return $content;
}]);
开发者ID:Akelcehg,项目名称:psycho,代码行数:56,代码来源:index.php

示例2: function

        <?php 
$widget = ListView::begin(['dataProvider' => $dataProvider, 'summary' => '', 'itemOptions' => ['class' => 'item'], 'itemView' => function ($model, $key, $index, $widget) {
    return '<div class="event-vanue" style="margin-top: 10px;">
                    <table>
                        <tbody>
                         <tr>
                            <td><p class="color">Название :</p></td>
                            <td>' . $model['name'] . '</td>
                            <td style="text-align: left;">
                               ' . Html::a('<span class="fa fa-pencil-square-o fa-2x"></span> Редактировать', Url::base() . '/account/event/update?id=' . $model['id']) . '
                            </td>
                        </tr>
                        <tr>
                            <td><p class="color">Дата :</p></td>
                            <td><i class="fa fa-calendar-o"></i>' . $model['date'] . ' <i
                                        class="fa fa-clock-o"></i>' . $model['duration'] . '</td>
                                        <td style="text-align: left;">
                        ' . Html::a('<span class="fa fa-trash-o fa-2x"></span> Удалить', Url::base() . '/account/event/delete?id=' . $model['id'], ['data-confirm' => "Are you sure you want to delete this item?", 'data-method' => 'POST']) . '
                                        </td>
                        </tr>
                        <tr>
                            <td><p class="color">Адрес :</p></td>
                            <td><i class="fa fa-map-marker"></i> ' . $model['address'] . '</td>
                            <td></td>
                        </tr>
                        </tbody>
                    </table>
        </div>';
}]);
?>
开发者ID:Akelcehg,项目名称:psycho,代码行数:30,代码来源:index.php

示例3: function

                            <div class="row">
                                <div class="col-md-12">
                                    <div class="comments">
                                        <h2>Latest Comments</h2>
                                        <ul>
                                            <?php 
$widget = ListView::begin(['dataProvider' => $articleCommentsList, 'summary' => '', 'itemOptions' => ['class' => 'item'], 'itemView' => function ($model, $key, $index, $widget) {
    $link = TranslitWidget::widget(['link' => $model['commentOwner']['firstname'] . '_' . $model['commentOwner']['lastname']]) . '-' . $model['commentOwner']['user_id'];
    $content = '<li>
                                                    <div class="thumb" style="width: 70px;">
                                                        <a href="' . Url::base() . '/psychologists/profile/' . $link . '">
                                                        <img class="img-responsive"
                                                        src="' . Image::getUserProfilePhoto($model['commentOwner']['user_id']) . '" alt=""></a>
                                                    </div>
                                                    <div class="text">
                                                        <h4><a href="' . Url::base() . '/psychologists/profile/' . $link . '">
                                                        ' . $model['commentOwner']['firstname'] . ' ' . $model['commentOwner']['lastname'] . '
                                                        </a></h4>
                                                        <p class="date">' . $model['created_at'] . '</p>
                                                        <p>' . $model['text'] . '</p>
                                                    </div>

                                                </li>';
    return $content;
}]);
?>

                                            <?php 
echo $widget->renderItems();
?>
开发者ID:Akelcehg,项目名称:psycho,代码行数:30,代码来源:view.php

示例4:

echo Yii::t('app', '学号');
?>
</th>
            <th><?php 
echo Yii::t('app', '姓名');
?>
</th>
            <th><?php 
echo Yii::t('app', '评论内容');
?>
</th>
            <th><?php 
echo Yii::t('app', '评论时间');
?>
</th>
            <th></th>
        </tr>
        </thead>
        <?php 
$listview = ListView::begin(['dataProvider' => $commentsProvider, 'itemView' => '_comments', 'layout' => '{items}']);
?>
        <?php 
ListView::end();
?>
    </table>
    <!-- 分页 -->
    <?php 
echo $listview->renderPager();
?>
</div>
开发者ID:dalinhuang,项目名称:wethepeople,代码行数:30,代码来源:view.php

示例5: function

$articleWidget = ListView::begin(['dataProvider' => $articleDataProvider, 'summary' => '', 'itemOptions' => ['class' => 'item'], 'itemView' => function ($model, $key, $index, $widget) {
    $link = TranslitWidget::widget(['link' => str_replace(' ', '_', trim($model['title']))]) . '-' . $model['id'];
    $plainBody = strip_tags($model['text']);
    $abrvBody = strlen($plainBody) > 500 ? substr($plainBody, 0, 500) . '...' : $plainBody;
    return '<div id="postlist">
                                                                <div class="panel">
                                                                    <div class="panel-heading">
                                                                        <div class="text-center">
                                                                            <div class="row">
                                                                                <div class="col-sm-9">
                                                                                    <h3 class="pull-left">' . $model["title"] . '</h3>
                                                                                </div>
                                                                                <div class="col-sm-3">
                                                                                    <h4 class="pull-right">
                                                                                        <small>
                                                                                        ' . $model['created_at'] . '
                                                                                        </small>
                                                                                    </h4>
                                                                                </div>
                                                                            </div>
                                                                        </div>
                                                                    </div>

                                                                    <div class="panel-body">
                                                                    ' . $abrvBody . '
                                                                     <!-- <a href="' . Url::base() . '/article/' . $link . '" class="btn-style" style="float: right;">Читать</a> -->
                                                                    </div>
                                                                   <div class="blog-comments">
                                <a href="#"><i class="fa fa-user"></i>user@gmail.com</a>
                                <a href="#"><i class="fa fa-calendar"></i>13 апр. 2016 г.</a>
                                <!-- <a href="#" class="pull-right"><i class="fa fa-comment"></i>35 Comments</a> -->
                                <a href="' . Url::base() . '/article/' . $link . '" class="btn-style pull-right" style="color:white;">Читать</a>
                            </div>

                                                                </div>

                                                            </div>';
}]);
开发者ID:Akelcehg,项目名称:psycho,代码行数:38,代码来源:profile.php

示例6:

?>

</div>
<div class="section-student dd-listview-table">
    <table class="table table-hover items-students">
        <thead>
        <tr>
            <th><?php 
echo Yii::t('app', '表态学生');
?>
</th>
            <th><?php 
echo Yii::t('app', '态度');
?>
</th>
            <th></th>
        </tr>
        </thead>
        <?php 
$listview = ListView::begin(['dataProvider' => $suggesDetailProvider, 'itemView' => '_suggesDetail', 'layout' => '{items}']);
?>
        <?php 
ListView::end();
?>
    </table>
    <!-- 分页 -->
    <?php 
echo $listview->renderPager();
?>
</div>
开发者ID:dalinhuang,项目名称:wethepeople,代码行数:30,代码来源:view.php

示例7: function

    <ul class="media-list forum">

        <?php 
$widget = ListView::begin(['dataProvider' => $topics, 'summary' => '', 'itemOptions' => ['class' => 'item'], 'itemView' => function ($model, $key, $index, $widget) {
    $content = '<li class="media well">
                                <div class="pull-left user-info" href="#">
                                    <img class="avatar img-circle img-thumbnail" src="http://snipplicious.com/images/guest.png"
                                         width="64" alt="Generic placeholder image">
                                    <strong><a href="user.html">John Doe</a></strong>
                                    <small>Member</small>
                                    <br>
                                    <small class="btn-group btn-group-xs">
                                        <a class="btn btn-default"><i class="fa fa-envelope"></i></a>
                                        <strong class="btn btn-success">98</strong>
                                    </small>
                                </div>
                                <div class="media-body">

                                    <div class="forum-post-panel btn-group btn-group-xs">
                                        <a href="#" class="btn btn-default"><i class="fa fa-clock-o"></i> ' . $model['created_at'] . '</a>
                                        <a href="#" class="btn btn-danger"><i class="fa fa-warning"></i> Пожаловаться</a>
                                    </div>

                                    <p>' . $model['text'] . '</p>

                                </div>
                            </li>';
    return $content;
}]);
?>

        <?php 
开发者ID:Akelcehg,项目名称:psycho,代码行数:32,代码来源:post.php

示例8: array

                    <?php 
$widget = ListView::begin(array('dataProvider' => $dataProvider, 'summary' => '', 'itemOptions' => array('class' => 'item'), 'itemView' => function ($model, $key, $index, $widget) {
    $a = new Article();
    $link = TranslitWidget::widget(['link' => str_replace(' ', '_', trim($model['title']))]) . '-' . $model['id'];
    $plainBody = strip_tags($model['text']);
    $abrvBody = strlen($plainBody) > 500 ? mb_substr($plainBody, 0, 500) . '...' : $plainBody;
    $firstImage = $a->catch_that_image($model['text']);
    $content = '<div class="blog-contant">
                            <h2><a href="' . Url::base() . '/article/' . $link . '">' . $model["title"] . '</a></h2>';
    if ($firstImage) {
        $content .= '<div class="thumb" >

                                <div class="col-md-3" >
                                    <a href="' . Url::base() . '/article/view/' . $link . '">
                                        <img class="img-responsive" src = "' . $a->catch_that_image($model['text']) . '" />
                                    </a>
                                </div >
                            </div >';
    }
    $content .= '<div class="text">' . $abrvBody . '
<!--                                <a href="' . Url::base() . '/article/' . $link . '" class="btn-style">Читать</a> -->
                            </div>
                            <div class="blog-comments">
                                <a href="#"><i class="fa fa-user"></i>' . Yii::$app->user->identity['email'] . '</a>
                                <a href="#"><i class="fa fa-calendar"></i>' . Yii::t('app', '{0,date}', strtotime($model['created_at'])) . '</a>
                                <!-- <a href="#" class="pull-right"><i class="fa fa-comment"></i>35 Comments</a> -->
                                <a href="' . Url::base() . '/article/' . $link . '" class="btn-style pull-right" style="color:white;">Читать</a>
                            </div>
                        </div>';
    return $content;
}));
?>
开发者ID:Akelcehg,项目名称:psycho,代码行数:32,代码来源:index.php

示例9: function

            </tr>
            </thead>
            <tbody>


            <?php 
$widget = ListView::begin(['dataProvider' => $topicPosts, 'summary' => '', 'itemOptions' => ['class' => 'item'], 'itemView' => function ($model, $key, $index, $widget) {
    $postLink = TranslitWidget::widget(['link' => str_replace(' ', '_', trim($model['title']))]) . '-' . $model['dpId'];
    $content = ' <tr>
                                    <td class="text-center"><i class="fa fa-envelope fa-2x text-primary"></i></td>
                                    <td style="text-align: left;">

                                        <p>
                                            <a href="' . Url::base() . "/post/" . $postLink . '">' . $model['title'] . '</a><br>
                                            <small>Some description' . $model['dpId'] . '</small>
                                        </p>

                                    </td>
                                    <!--<td class="text-center hidden-xs hidden-sm"><a href="#">9 542</a></td>-->
                                    <td class="text-center hidden-xs hidden-sm"><a href="#">89 897</a></td>
                                    <td class="hidden-xs hidden-sm">by <a href="#">John Doe</a><br>
                                        <small><i class="fa fa-clock-o"></i> 3 months ago</small>
                                    </td>
                                </tr>';
    return $content;
}]);
?>

            <?php 
echo $widget->renderItems();
?>
开发者ID:Akelcehg,项目名称:psycho,代码行数:31,代码来源:single-topic.php


注:本文中的yii\widgets\ListView::begin方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。