Пример #1
0
<?php

use app\models\Focus;
$focus = Focus::getFocus();
?>
<div class="panel panel-default">
	<div class="panel-heading"><?php 
echo $menu['label'];
?>
设置</div>
	<div class="panel-body">
		<p><span class="glyphicon glyphicon-bookmark"></span> 添加焦点图: 进入<a href="/user/blog/list">博客列表</a> 添加</p>
	<table class="table">
		<tr>
			<th width=35%>图片</th>
			<th width=50%>标题</th>
			<th width=15%>排序</th>
		</tr>
<?php 
if ($focus) {
    foreach ($focus as $row) {
        ?>
		<tr>
		<td><img width=100 src="<?php 
        echo $row['image'];
        ?>
"></td>
		<td><?php 
        echo $row['title'];
        ?>
</td>
Пример #2
0
 public static function getFocus($type = self::TYPE_INDEX)
 {
     $where['type'] = 1;
     $data = Focus::find()->where($where)->asArray()->orderBy(['sortno' => SORT_ASC, 'id' => SORT_DESC])->all();
     return $data;
 }