@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
defined('IN_TS') or die('Access Denied.');
|
||||
//插件信息
|
||||
return array(
|
||||
'hook'=>'home_index_left', //钩子
|
||||
'name' => '首页推荐文章',
|
||||
'version' => '1.0',
|
||||
'desc' => '首页推荐文章',
|
||||
'url' => 'https://www.thinksaas.cn',
|
||||
'email' => 'thinksaas@qq.com',
|
||||
'author' => '邱君',
|
||||
'author_url' => 'https://www.thinksaas.cn',
|
||||
'isedit' => '1',
|
||||
);
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
defined('IN_TS') or die('Access Denied.');
|
||||
|
||||
//插件编辑
|
||||
switch($ts){
|
||||
case "set":
|
||||
|
||||
$strAbout = fileRead('plugins/home/recommendarticle/about.php');
|
||||
|
||||
$strData = fileRead('data/plugins_home_recommendarticle.php');
|
||||
if($strData==''){
|
||||
$strData = $GLOBALS['tsMySqlCache']->get('plugins_home_recommendarticle');
|
||||
}
|
||||
|
||||
include template('edit_set','recommendarticle');
|
||||
break;
|
||||
|
||||
case "do":
|
||||
$isrecommend = intval($_POST['isrecommend']);
|
||||
|
||||
$strData = array(
|
||||
'isrecommend'=>$isrecommend,
|
||||
);
|
||||
|
||||
fileWrite('plugins_home_recommendarticle.php','data',$strData);
|
||||
$tsMySqlCache->set('plugins_home_recommendarticle',$strData);
|
||||
|
||||
header('Location: '.SITE_URL.'index.php?app=home&ac=plugin&plugin=recommendarticle&in=edit&ts=set');
|
||||
break;
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
{php include pubTemplate("header_admin")}
|
||||
|
||||
|
||||
<div class="midder">
|
||||
|
||||
{php include pubTemplate("plugin_menu")}
|
||||
|
||||
<form method="POST" action="{SITE_URL}index.php?app=home&ac=plugin&plugin=recommendarticle&in=edit&ts=do">
|
||||
<table class="table table-hover">
|
||||
|
||||
<tr><td>内容获取方式:</td><td>
|
||||
|
||||
<input type="radio" name="isrecommend" value="0" {if $strData['isrecommend']==0}checked{/if}> 最新内容
|
||||
<input type="radio" name="isrecommend" value="1" {if $strData['isrecommend']==1}checked{/if}> 推荐内容
|
||||
|
||||
</td></tr>
|
||||
|
||||
<tr><td></td><td><input type="submit" value="提交修改" /></td></tr>
|
||||
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
{php include pubTemplate("footer_admin")}
|
||||
@@ -0,0 +1,104 @@
|
||||
<div class="card">
|
||||
<div class="card-header">推荐文章</div>
|
||||
<div class="card-body">
|
||||
|
||||
{if $arrArticle}
|
||||
{loop $arrArticle $key $item}
|
||||
{if $item['photo']}
|
||||
<div class="row border-bottom mb-3 pb-3">
|
||||
|
||||
<div class="col-md-4">
|
||||
<a href="{tsUrl('article','show',array('id'=>$item['articleid']))}">
|
||||
<img class="mw-100" src="{$item['photo_url']}" />
|
||||
</a>
|
||||
</div>
|
||||
<div class="col-md-8">
|
||||
|
||||
<div class="fs18 font-weight-bold">
|
||||
<a href="{tsUrl('article','show',array('id'=>$item['articleid']))}">{$item['title']}</a>
|
||||
{if $item['istop']=='1'}
|
||||
<img src="{SITE_URL}public/images/ding.png" width="24" height="24" title="[置顶]" alt="[置顶]" />
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
<div class="fs12 text-black-50"><a class="text-black-50" href="{tsUrl('user','space',array('id'=>$item['user']['userid']))}">{$item['user']['username']}</a> 发表于 {$item['addtime']}</div>
|
||||
|
||||
<div class="text-black-50 mt-1">{if $item['gaiyao']}{tsTitle($item['gaiyao'])}{else}暂无概要{/if} (<a href="{tsUrl('article','show',array('id'=>$item['articleid']))}">查看全文</a>)</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="of c9 mt-3 fs12">
|
||||
|
||||
<div class="float-left">
|
||||
分类:<a href="{tsUrl('article','cate',array('id'=>$item['cate']['cateid']))}">{$item['cate']['catename']}</a>
|
||||
</div>
|
||||
<div class="float-right">
|
||||
|
||||
<i class="bi bi-eye"></i> {$item['count_view']}
|
||||
<i class="bi bi-chat-text ml-3"></i> {$item['count_comment']}
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
{else}
|
||||
|
||||
<div class="fs18 font-weight-bold">
|
||||
<a href="{tsUrl('article','show',array('id'=>$item['articleid']))}">{$item['title']}</a>
|
||||
{if $item['istop']=='1'}
|
||||
<img src="{SITE_URL}public/images/ding.png" width="24" height="24" title="[置顶]" alt="[置顶]" />
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
<div class="fs12 text-black-50"><a class="text-black-50" href="{tsUrl('user','space',array('id'=>$item['user']['userid']))}">{$item['user']['username']}</a> 发表于 {$item['addtime']}</div>
|
||||
|
||||
{if $item['score']==0}
|
||||
<div class="text-black-50 mt-1">{if $item['gaiyao']}{$item['gaiyao']}{else}暂无概要{/if} (<a href="{tsUrl('article','show',array('id'=>$item['articleid']))}">查看全文</a>)</div>
|
||||
{/if}
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="of c9 mt-3 fs12 mb-3 border-bottom pb-3">
|
||||
|
||||
<div class="float-left">
|
||||
分类:<a href="{tsUrl('article','cate',array('id'=>$item['cate']['cateid']))}">{$item['cate']['catename']}</a>
|
||||
</div>
|
||||
<div class="float-right">
|
||||
|
||||
<i class="bi bi-eye"></i> {$item['count_view']}
|
||||
<i class="bi bi-chat-text ml-3"></i> {$item['count_comment']}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
{/if}
|
||||
|
||||
|
||||
|
||||
{/loop}
|
||||
|
||||
{else}
|
||||
|
||||
<div class="c9">暂无推荐文章</div>
|
||||
|
||||
{/if}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
defined('IN_TS') or die('Access Denied.');
|
||||
|
||||
function recommendarticle(){
|
||||
|
||||
$strData = fileRead('data/plugins_home_recommendarticle.php');
|
||||
if($strData==''){
|
||||
$strData = $GLOBALS['tsMySqlCache']->get('plugins_home_recommendarticle');
|
||||
}
|
||||
|
||||
if($strData['isrecommend']==1){
|
||||
$where = array(
|
||||
'isrecommend'=>1,
|
||||
'isaudit'=>0
|
||||
);
|
||||
}else{
|
||||
$where = array(
|
||||
'isaudit'=>0
|
||||
);
|
||||
}
|
||||
|
||||
$arrArticle = aac('article')->findAll('article',$where,'istop desc,addtime desc','articleid,cateid,userid,title,gaiyao,path,photo,count_view,count_comment,istop,addtime,uptime',10);
|
||||
foreach($arrArticle as $key=>$item){
|
||||
$arrArticle[$key]['title'] = tsTitle($item['title']);
|
||||
$arrArticle[$key]['gaiyao'] = tsTitle($item['gaiyao']);
|
||||
$arrArticle[$key]['user'] = aac('user')->getSimpleUser($item['userid']);
|
||||
if($item['cateid']){
|
||||
$arrArticle[$key]['cate'] = aac('article')->find('article_cate',array(
|
||||
'cateid'=>$item['cateid'],
|
||||
));
|
||||
}
|
||||
|
||||
#封面图
|
||||
if($item['photo']){
|
||||
$arrArticle[$key]['photo_url'] = aac('article')->getArticlePhoto($item);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
include template('recommendarticle','recommendarticle');
|
||||
|
||||
}
|
||||
|
||||
addAction('home_index_left','recommendarticle');
|
||||
Reference in New Issue
Block a user