feat/task1-c-wallet
parent
fda8620b0d
commit
2b3b8cbe16
|
|
@ -1,114 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Home\Controller;
|
||||
|
||||
/**
|
||||
* 频道
|
||||
* @author Devil
|
||||
* @blog http://gong.gg/
|
||||
* @version 0.0.1
|
||||
* @datetime 2016-12-01T21:51:08+0800
|
||||
*/
|
||||
class ChannelController extends CommonController
|
||||
{
|
||||
/**
|
||||
* [_initialize 前置操作-继承公共前置方法]
|
||||
* @author Devil
|
||||
* @blog http://gong.gg/
|
||||
* @version 0.0.1
|
||||
* @datetime 2016-12-03T12:39:08+0800
|
||||
*/
|
||||
public function _initialize()
|
||||
{
|
||||
// 调用父类前置方法
|
||||
parent::_initialize();
|
||||
}
|
||||
|
||||
/**
|
||||
* [Index 频道]
|
||||
* @author Devil
|
||||
* @blog http://gong.gg/
|
||||
* @version 0.0.1
|
||||
* @datetime 2016-12-06T21:31:53+0800
|
||||
*/
|
||||
public function Index()
|
||||
{
|
||||
// 模型对象
|
||||
$m = M('Article');
|
||||
|
||||
// 条件
|
||||
$where = $this->GetIndexWhere();
|
||||
|
||||
// 分页
|
||||
$number = 10;
|
||||
$page_param = array(
|
||||
'number' => $number,
|
||||
'total' => $m->where($where)->count(),
|
||||
'where' => $_GET,
|
||||
'url' => U('Home/Channel/Index'),
|
||||
);
|
||||
$page = new \My\Page($page_param);
|
||||
|
||||
// 获取列表
|
||||
$list = LayoutArticleDataHandle($m->where($where)->limit($page->GetPageStarNumber(), $number)->order('id desc')->select());
|
||||
|
||||
// 分页
|
||||
$this->assign('page_html', $page->GetPageHtml());
|
||||
|
||||
// 数据列表
|
||||
$this->assign('list', $list);
|
||||
|
||||
// 布局+模块列表
|
||||
$this->assign('data', $this->GetLayoutList('channel'));
|
||||
|
||||
// 友情链接
|
||||
$this->assign('link', LayoutLink('channel', 1));
|
||||
|
||||
// 频道数据
|
||||
$channel = $this->GetChannelData();
|
||||
|
||||
// 浏览器标题
|
||||
$title = isset($channel[I('id')]) ? $channel[I('id')] : '';
|
||||
$this->assign('home_seo_site_title', $this->GetBrowserSeoTitle($title, MyC('home_seo_channel_browser')));
|
||||
|
||||
$this->display('Index');
|
||||
}
|
||||
|
||||
/**
|
||||
* [GetChannelData 获取频道数据]
|
||||
* @author Devil
|
||||
* @blog http://gong.gg/
|
||||
* @version 0.0.1
|
||||
* @datetime 2017-02-25T14:38:33+0800
|
||||
*/
|
||||
private function GetChannelData()
|
||||
{
|
||||
$data = S(C('cache_home_channel_key'));
|
||||
if(empty($data))
|
||||
{
|
||||
$data = M('ArticleClass')->getField('id,name');
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* [GetIndexWhere 文章列表条件]
|
||||
* @author Devil
|
||||
* @blog http://gong.gg/
|
||||
* @version 0.0.1
|
||||
* @datetime 2016-12-10T22:16:29+0800
|
||||
*/
|
||||
private function GetIndexWhere()
|
||||
{
|
||||
$where = array();
|
||||
|
||||
// 文章分类id
|
||||
if(!empty($_REQUEST['id']))
|
||||
{
|
||||
$where['article_class_id'] = intval(I('id'));
|
||||
}
|
||||
|
||||
return $where;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
@ -1,101 +0,0 @@
|
|||
<include file="Public/Header" />
|
||||
|
||||
<!-- header nav start -->
|
||||
<include file="Public/HeaderNav" />
|
||||
<!-- header nav end -->
|
||||
|
||||
<!-- content start -->
|
||||
<div class="am-g my-content" <if condition="!empty($max_width_style)">style="{{$max_width_style}}"</if>>
|
||||
<!-- left start -->
|
||||
<div class="am-u-md-8 m-t-10 channel-left">
|
||||
<!-- list start -->
|
||||
<if condition="!empty($list)">
|
||||
<div data-am-widget="list_news" class="am-list-news am-list-news-default channel-list">
|
||||
<div class="am-list-news-bd">
|
||||
<ul class="am-list">
|
||||
<foreach name="list" item="v">
|
||||
<if condition="empty($v['image'][0])">
|
||||
<li class="am-g am-list-item-desced">
|
||||
<div class=" am-list-main">
|
||||
<h3 class="am-list-item-hd">
|
||||
<a href="{{$v.url}}" target="_blank" <if condition="!empty($v['title_color'])"> style="color:{{$v.title_color}};" </if>>{{$v.title}}</a>
|
||||
</h3>
|
||||
<div class="am-list-item-text">{{:mb_substr(strip_tags($v['content']), 0, 80, C('DEFAULT_CHARSET'))}}</div>
|
||||
</div>
|
||||
</li>
|
||||
<else />
|
||||
<li class="am-g am-list-item-desced am-list-item-thumbed am-list-item-thumb-left">
|
||||
<div class="am-u-sm-4 am-list-thumb">
|
||||
<a href="{{$v.url}}" target="_blank">
|
||||
<img src="{{$image_host}}{{$v['image'][0]}}" alt="{{$v.title}}"/>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class=" am-u-sm-8 am-list-main">
|
||||
<h3 class="am-list-item-hd">
|
||||
<a href="{{$v.url}}" target="_blank" <if condition="!empty($v['title_color'])"> style="color:{{$v.title_color}};" </if>>{{$v.title}}</a>
|
||||
</h3>
|
||||
<div class="am-list-item-text">{{:mb_substr(strip_tags($v['content']), 0, 80, C('DEFAULT_CHARSET'))}}</div>
|
||||
</div>
|
||||
</li>
|
||||
</if>
|
||||
</foreach>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
{{$page_html}}
|
||||
<else />
|
||||
<include file="Public/NoData" />
|
||||
</if>
|
||||
<!-- list end -->
|
||||
</div>
|
||||
<!-- left end -->
|
||||
<!-- right start -->
|
||||
<div class="am-u-md-4 channel-right">
|
||||
<!-- layout module start -->
|
||||
<if condition="!empty($data)">
|
||||
<foreach name="data" item="v">
|
||||
<switch name="v.value">
|
||||
<case value="100">
|
||||
<if condition="!empty($v['item'][0])">
|
||||
<div class="layout-{{$v.value}}">{{$v['item'][0]}}</div>
|
||||
</if>
|
||||
</case>
|
||||
<case value="122|123|124|236">
|
||||
<php>list($t1, $t2, $t3) = str_split($v['value']);</php>
|
||||
<ul data-am-widget="gallery" class="am-gallery am-avg-sm-{{$t1}} am-avg-md-{{$t2}} am-avg-lg-{{$t3}} am-gallery-overlay small-banner am-no-layout m-b-5 layout-100-{{$v.value}}" data-am-gallery="{}">
|
||||
<if condition="!empty($v['item'])">
|
||||
<foreach name="v.item" item="vs">
|
||||
<li class="layout-item">
|
||||
<div class="layout-100-{{$v.value}}-item">{{$vs}}</div>
|
||||
</li>
|
||||
</foreach>
|
||||
</if>
|
||||
</ul>
|
||||
</case>
|
||||
<case value="84|48|633|363|336">
|
||||
<php>$t_all = str_split($v['value']);</php>
|
||||
<div class="layout-100-{{$v.value}} o-h">
|
||||
<if condition="!empty($v['item'])">
|
||||
<foreach name="v.item" key="ks" item="vs">
|
||||
<div class="am-u-md-{{$t_all[$ks]}}">{{$vs}}</div>
|
||||
</foreach>
|
||||
</if>
|
||||
</div>
|
||||
</case>
|
||||
</switch>
|
||||
</foreach>
|
||||
</if>
|
||||
<!-- layout module end -->
|
||||
</div>
|
||||
<!-- right end -->
|
||||
</div>
|
||||
<!-- content end -->
|
||||
|
||||
<!-- layuot common module start -->
|
||||
<include file="Public/CommonModule" />
|
||||
<!-- layuot common module end -->
|
||||
|
||||
<!-- footer start -->
|
||||
<include file="Public/Footer" />
|
||||
<!-- footer end -->
|
||||
Loading…
Reference in New Issue