国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 網站 > 建站經驗 > 正文

ECSHOP后臺給文章加上日期時間修改

2024-04-25 20:32:08
字體:
來源:轉載
供稿:網友

ECSHOP后臺給文章加上日期時間修改,添加好的文章怎么才能改時間,比如說我是幾年前添加的文章但是百度收錄了我又不想去刪除,想改到近期的時間,下面就由A5源碼幫你解決

首先打開文件夾admin/templates/article_info.htm

加一個修改時間

在第三行下面加入調用日歷 JS

<script type="text/javascript" src="../js/calendar.php?lang={$cfg_lang}"></script>

<link href="../js/calendar/calendar.css" rel="stylesheet" type="text/css" />

-------------------------------------------

修改代碼:

找到代碼:

<tr>

<td>{$lang.author}</td>

<td><input type="text" name="author" maxlength="60" value="{$article.author|escape}" /></td>

</tr>

在下面加入以下代碼:

<!--新加日期修改-->

<tr>

<td>{$lang.add_time}</td>

<td><input name="add_time" type="text" id="add_time" size="20" value='{$article.add_time}' readonly="readonly" /><input name="selbtn1" type="button" id="selbtn1" onclick="return showCalendar('add_time', '%Y-%m-%d %H:%M', '24', false, 'selbtn1');" value="{$lang.btn_select}"/></td>

</tr>

<!--新加日期修改 結束-->

-------------------------------------------

然后去article.php寫點程序

找到 (添加文章)

/*初始化*/

$article = array();

$article['is_open'] = 1;

在下面加上以下代碼:

$article['add_time'] = local_date('Y-m-d H:i');

-----------------------------------------------

找到文章 (編輯文章) 代碼:

/* 取文章數據 */

$sql = "SELECT * FROM " .$ecs->table('article'). " WHERE article_id='$_REQUEST[id]'";

$article = $db->GetRow($sql);

在下面加上以下代碼:

$article['add_time'] = local_date('Y-m-d H:i',$article['add_time']);

---------------------------------

/*插入數據*/

$add_time = gmtime();

if (empty($_POST['cat_id']))

{

$_POST['cat_id'] = 0;

}

$sql = "INSERT INTO ".$ecs->table('article')."(title, cat_id, article_type, is_open, author, ".

"author_email, keywords, content, add_time, file_url, open_type, link) ".

"VALUES ('$_POST[title]', '$_POST[article_cat]', '$_POST[article_type]', '$_POST[is_open]', ".

"'$_POST[author]', '$_POST[author_email]', '$_POST[keywords]', '$_POST[FCKeditor1]', ".

"'$add_time', '$file_url', '$open_type', '$_POST[link_url]')";

$db->query($sql);

修改為:

/*插入數據*/

$add_time = gmtime();

if (empty($_POST['cat_id']))

{

$_POST['cat_id'] = 0;

}

$add_time = local_strtotime($_POST['add_time']);

$sql = "INSERT INTO ".$ecs->table('article')."(title, cat_id, article_type, is_open, author, ".

"author_email, keywords, content, add_time, file_url, open_type, link) ".

"VALUES ('$_POST[title]', '$_POST[article_cat]', '$_POST[article_type]', '$_POST[is_open]', ".

"'$_POST[author]', '$_POST[author_email]', '$_POST[keywords]', '$_POST[FCKeditor1]', ".

"'$add_time', '$file_url', '$open_type', '$_POST[link_url]')";

$db->query($sql);

----------------------------------

if ($exc->edit("title='$_POST[title]', cat_id='$_POST[article_cat]', article_type='$_POST[article_type]', is_open='$_POST[is_open]', author='$_POST[author]', author_email='$_POST[author_email]', keywords ='$_POST[keywords]', file_url ='$file_url', open_type='$open_type', content='$_POST[FCKeditor1]', link='$_POST[link_url]' ", $_POST['id']))
修改為:
$add_time = local_strtotime($_POST['add_time']);

if ($exc->edit("title='$_POST[title]', cat_id='$_POST[article_cat]', article_type='$_POST[article_type]', is_open='$_POST[is_open]', author='$_POST[author]', add_time='$add_time',author_email='$_POST[author_email]', keywords ='$_POST[keywords]', file_url ='$file_url', open_type='$open_type', content='$_POST[FCKeditor1]', link='$_POST[link_url]' ", $_POST['id']))

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 邵东县| 淮北市| 大城县| 甘泉县| 大化| 双峰县| 五河县| 鄄城县| 白银市| 绵竹市| 双江| 特克斯县| 横峰县| 镇江市| 香河县| 乐都县| 太仆寺旗| 如东县| 玉屏| 海原县| 商河县| 陇川县| 新绛县| 稷山县| 白银市| 大埔县| 峨眉山市| 光泽县| 曲麻莱县| 利津县| 巴彦县| 利川市| 沂南县| 舞钢市| 金溪县| 杭锦旗| 南宁市| 开化县| 贺兰县| 新乐市| 三河市|