AutoCAD 3DMAX C语言 Pro/E UG JAVA编程 PHP编程 Maya动画 Matlab应用 Android
Photoshop Word Excel flash VB编程 VC编程 Coreldraw SolidWorks A Designer Unity3D
 首页 > PHP编程

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

51自学网 2016-09-26 http://www.51zixue.net
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="{$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>


说明
:本教程来源互联网或网友上传或出版商,仅为学习研究或媒体推广,51zixue.net不保证资料的完整性。
 
上一篇:如何在Ecshop中增加用户订单编辑功能  下一篇:如何实现ecshop在商品搜索结果页显示商品货号的方法