public function beginLoopData($dataSource, $item, $appendOptions = []) { $options = []; $options['dataSource'] = $dataSource; $options['item'] = Resource::getThemePath($item); return LoopData::begin($options); }
</div> </div> </div> <div id="comment-ad" class="banner banner-related"> </div> <a name="comments"></a> <div class="ds-thread" data-thread-key="3975" data-author-key="1" data-title="" data-url=""></div> </div> </div> <aside class="sidebar"> <?php echo $this->render(Resource::getThemePath('/views/_inc/takonomy'), ['takonomyId' => 'page_takonomy']); ?> <div class="widget d_postlist"> <div class="title"> <h2>为您推荐</h2> </div> <ul> <?php $datas = $this->getDataSource(null, null, 5, ['is_pic' => true]); $this->loopData($datas, '/views/_inc/item_pic'); ?> </ul> </div> <div class="widget d_postlist"> <div class="title"> <h2>热评文章</h2>
?> <li><?php echo Html::a($takonomy['name'], ['/post/default/list', 'takonomy' => $takonomy['id']]); ?> </li> <?php } ?> </ul> </div> <div class="widget d_postlist"> <div class="title"><h2>热评文章</h2></div> <ul> <?php echo $this->render(Resource::getThemePath('/views/_inc/post_list_widget'), ['orderBy' => 'comment_count desc', 'limit' => 3]); ?> </ul> </div> <div class="widget ds-widget-recent-visitors"> <div class="title"><h2>最近访客</h2></div> <ul class="ds-recent-visitors" data-num-items="15" data-show-time="0" data-avatar-size="50"> </ul> </div> <script> if (typeof DUOSHUO !== 'undefined') DUOSHUO.RecentVisitors('.ds-recent-visitors'); </script> </aside>
</ul> </div> <div class="widget d_postlist"> <div class="title"><h2>为您推荐</h2></div> <ul> <?php echo $this->render(Resource::getThemePath('/views/_inc/content_list'), ['orderBy' => 'created_at desc']); ?> </ul> </div> <div class="widget d_postlist"> <div class="title"><h2>热评文章</h2></div> <ul> <?php echo $this->render(Resource::getThemePath('/views/_inc/content_list'), ['orderBy' => 'created_at desc']); ?> </ul> </div> <div class="widget ds-widget-recent-visitors"> <div class="title"><h2>最近访客</h2></div> <ul class="ds-recent-visitors" data-num-items="15" data-show-time="0" data-avatar-size="50"> </ul> </div> <script> if (typeof DUOSHUO !== 'undefined') DUOSHUO.RecentVisitors('.ds-recent-visitors'); </script> </aside>
use source\LuLu; /* @var $this yii\web\View */ if (!isset($orderBy)) { $orderBy = 'created_at desc'; } if (!isset($limit)) { $limit = 5; } if (!isset($item)) { $item = 'item_pic'; } $where = []; if (!isset($isPic)) { $isPic = true; } $moduleId = LuLu::$app->controller->module->id; if ($moduleId !== 'app-frontend') { $where = ['content_type' => $moduleId]; } $query = Content::findQuery($where, $orderBy); if ($isPic) { $query->andWhere(['!=', 'thumb', '']); } $query->limit($limit); $contents = $query->all(); ?> <?php foreach ($contents as $content) { echo $this->render(Resource::getThemePath('/views/_inc/' . $item), ['content' => $content]); }