国产激情高潮在线观看-中文字幕有码视频推荐-国产三级全黄芒果视频-久久国产美女一区精品

18038435860

JTBC_PHP 3.0.1.6版本增加文章定時發(fā)布功能(二)

時間:2018-11-30 23:19:19 點擊:678 來源:易速網(wǎng)絡(luò)

1、數(shù)據(jù)庫jtbc_news增加字段n_timing,類型DATETIME,注釋{"fieldType":"text"}
 
<item>
<name><![CDATA[timing]]></name>
<zh-cn><![CDATA[定時]]></zh-cn>
</item>
 
 
$nowTime = base::getDateTime();
    if ($category == 0){
      $sqlstr = "select * from jtbc_news where n_delete=0 and n_publish=1 and n_timing< '" .$nowTime."' order by n_time desc";
    } else {
      $sqlstr = "select * from jtbc_news where n_delete=0 and n_publish=1 and n_timing< '" .$nowTime."' and n_category = '" .$category."' order by n_time desc";
    }
    $pagi = new pagi();
    $rsAry = $pagi -> getDataAry($page, $pagesize, $sqlstr);
 
~~~~~~~~~~~~~~~~~~~~~~~~~
4、/* $dal -> orderBy('time', 'desc');
$pagi = new pagi($dal);
$rsAry = $pagi -> getDataAry($page, $pagesize);*/
    注釋掉這3行
 
5、設(shè)置發(fā)布時間,定時發(fā)布時間格式2018-11-09 10:45:28,點發(fā)布開關(guān)到綠色發(fā)布狀態(tài),然后提交。

 

1.jtbc.push.js放至/console/common/assets/js
2.push.inc.php放至/console/common/incfiles
3.在/news/template/manage.jtbc中查找
<name><![CDATA[list]]></name>節(jié)點,注意是[list]節(jié)點,在第3個<default><![CDATA[<nav genre="{$=$genre}"><span>{$-account-nav}{$=universal\category::getCategoryNavByID($getPara('genre'), '{$-lang}', '{$-nav-category}')}</span></nav>
后添加<script type="text/javascript" src="{$=$assetspath}/js/jtbc.push.js"></script>

 

如果你在其他地方調(diào)用新聞標(biāo)題列表,比如首頁,就加上一句SQL

比如這個<jtbc $function="transfer" $parameter="genre=news;type=new;limit=6;osql= and n_time<now()">

還有這個{$=transfer('genre=news;category=3;type=new;limit=24;osql= and n_time<now();baseurl=./;tpl=news_list')}

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

jtbc.push.js代碼如下

$(document).ready(function(){
var s = jQueryAjaxPost("2");
});
function jQueryAjaxPost(pushData) {
var return_data = "";
$.ajax({
type: "POST",
dataType: "json",
url: "common/incfiles/push.inc.php",
data: pushData,
async: false,
success: function(data, status) {
if(status == "success") {
return_data = data;
} else {
return_data = "error";
}
}
});
return return_data;
}

 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

push.inc.php代碼如下

<?php
include_once ("../../../common/incfiles/const.php");
$r = array();
@$db = mysqli_connect(DB_HOST, DB_USERNAME, DB_PASSWORD, DB_DATABASE);
if (mysqli_connect_errno()) {
echo json_encode("sorry,the conntect had some wrongs");
exit ;
}
$read = "select n_id,n_time,n_timing from jtbc_news where n_id=(select max(n_id) from jtbc_news)";
$result = mysqli_query($db, $read);
$rownumber = mysqli_num_rows($result);
for ($i = 0; $i < $rownumber; $i++) {
$row = mysqli_fetch_assoc($result);
array_push($r, $row['n_id'], $row['n_time'],$row['n_timing']);
}
if(($r[2]!=null)&&($r[1]!=$r[2])){
$up="update jtbc_news set n_time='$r[2]' where n_id='$r[0]'";
mysqli_query($db, $up);
}
mysqli_close($db);
echo json_encode("ok");
?>

 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

中江县| 怀安县| 团风县| 昌江| 句容市| 平乡县| 华亭县| 沭阳县| 明水县| 新营市| 怀仁县| 伽师县| 潮安县| 当阳市| 马边| 松江区| 隆昌县| 阿拉善右旗| 新晃| 青川县| 乌恰县| 巴林左旗| 沂水县| 河源市| 东乡| 洛宁县| 桃园县| 库尔勒市| 齐河县| 宜兰县| 武夷山市| 水富县| 洛浦县| 阿拉善右旗| 全椒县| 鄱阳县| 漯河市| 阿拉善左旗| 三穗县| 涞源县| 聂荣县|