首页 > 代码库 > 如何在ecshop文章详情页增加文章描述

如何在ecshop文章详情页增加文章描述

1.准备文件:前台article.php 后台 admin/article.php   和   admin/templates/article_info.htm
2.数据库: 执行下面语句(如有需要,则更改表头ecs)
ALTER  TABLE  `esc_article`  ADD  `article_desc` LONGTEXT NOT  NULL  AFTER  `keywords`
也可到phpMyAdmin 中 找到表 ecs_article, 添加字段article_desc, 属性设置如上.

【开始修改】:
1.修改前台:article.php
找到: $smarty->assign(‘descriptions‘, htmlspecialchars($article[‘title‘]));
在 下面加上    $smarty->assign(‘description‘,  htmlspecialchars($article[‘article_desc‘]));
前台就修改好了。

2.修改后台:
1) admin/article.php
找 到:    $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[keywords]‘, ‘$_POST[author_email]‘, ‘$_POST[FCKeditor1]‘, ".
                "‘$add_time‘, ‘$file_url‘, ‘$open_type‘, ‘$_POST[link_url]‘)";
将其替换为    $sql = "INSERT INTO ".$ecs->table(‘article‘)."(title, cat_id, article_type, is_open, author, ".
                "author_email, keywords,article_desc,content, add_time, file_url, open_type, link) ".
            "VALUES (‘$_POST[title]‘, ‘$_POST[article_cat]‘, ‘$_POST[article_type]‘, ‘$_POST[is_open]‘, ".
                "‘$_POST[author]‘, ‘$_POST[keywords]‘, ‘$_POST[article_desc]‘, ‘$_POST[author_email]‘, ‘$_POST[FCKeditor1]‘, ".
                "‘$add_time‘, ‘$file_url‘, ‘$open_type‘, ‘$_POST[link_url]‘)";

找 到:    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‘]))
将 其替换为:
    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]‘, article_desc =‘$_POST[article_desc]‘, file_url =‘$file_url‘, open_type=‘$open_type‘, content=‘$_POST[FCKeditor1]‘, link=‘$_POST[link_url]‘ ", $_POST[‘id‘]))
2) 修改admin/templates/article_info.htm
找到 <tr>
        <td class="narrow-label">{$lang.keywords}</td>
        <td><input type="text" name="keywords" maxlength="60" value="http://www.mamicode.com/{$article.keywords|escape}" /></td>
      </tr>
在下面添加    
      <tr>
        <td class="narrow-label">文章描述</td>
        <td><textarea name="article_desc" cols="40" rows="5" >{$article.article_desc|escape}</textarea></td>
      </tr>
 

www.wangzhanjianshegs.com

如何在ecshop文章详情页增加文章描述