1. 首先需要去数据表里[pre_portal_article_title]手动添加需要添加的字段. (注意: 数据表前缀依据自己的设置而定)
2. 修改模版template\default\portal\portalcp_article.htm文件 (注意: 如果是自建主题的话, 建议把默认的文件复制一份到自己的主题文件里相应的文件夹下, 添加相对应的文件内容)
[这里可以给大家提供一个思路, 可以在这个文件里查找 'exfm pns cl' , 可以在这个div后面, 再添加对应的div, 书写自己的字段内容]
以下是我自定义的几个字段, 供参考
- <div class="exfm pns cl">
- <div class="sinf sppoll z">
- <dl>
- <dt>下载地址</dt>
- <dd><input type="text" name="download_url" class="px p_fre" value="$article[download_url]" size="30" /></dd>
- <dt>下载大小</dt>
- <dd><input type="text" name="download_size" class="px p_fre" value="$article[download_size]" size="30" /></dd>
- <dt>下载类型</dt>
- <dd><input type="text" name="download_type" class="px p_fre" value="$article[download_type]" size="30" /></dd>
- <dt>下载官网</dt>
- <dd><input type="text" name="download_official_website" class="px p_fre" value="$article[download_official_website]" size="30" /></dd>
- </dl>
- </div>
- <div class="sadd z">
- <dl>
- <dt>新游下载</dt>
- <dd><input type="text" name="newgame_url" class="px p_fre" value="$article[newgame_url]" size="30" /></dd>
- <dt>新游官网</dt>
- <dd><input type="text" name="newgame_web" class="px p_fre" value="$article[newgame_web]" size="30" /></dd>
- <dt>新游状态</dt>
- <dd><input type="text" name="newgame_status" class="px p_fre" value="$article[newgame_status]" size="30" /></dd>
- <dt>新游激活码</dt>
- <dd><input type="text" name="newgame_f" class="px p_fre" value="$article[newgame_f]" size="30" /></dd>
- <dt>新游开发商</dt>
- <dd><input type="text" name="newgame_kfs" class="px p_fre" value="$article[newgame_kfs]" size="30" /></dd>
- <dt>新游运营商</dt>
- <dd><input type="text" name="newgame_yys" class="px p_fre" value="$article[newgame_yys]" size="30" /></dd>
- <dt>新游测试时间</dt>
- <dd><input type="text" name="newgame_ce_time" class="px p_fre" value="$article[newgame_ce_time]" size="30" onclick="showcalendar(event, this, true)" /></dd>
- </dl>
- </div>
- </div>
复制代码 3. 修改程序 include/portalcp/portalcp_article.php 找到数组 $setarr, 把自定义的字段, 添加进来, 注意过滤特殊字符(可以使用 htmlspecialchars 来过滤)- -$setarr = array(
- >--->---'title' => $_POST['title'],
- >--->---'author' => $_GET['author'],
- >--->---'from' => $_GET['from'],
- >--->---'fromurl' => $_GET['fromurl'],
- >--->---'dateline' => intval($_GET['dateline']),
- >--->---'url' => $_GET['url'],
- >--->---'allowcomment' => !empty($_POST['forbIDComment']) ? '0' : '1',
- >--->---'summary' => $summary,
- >--->---'catid' => intval($_POST['catid']),
- >--->---'tag' => article_make_tag($_POST['tag']),
- >--->---'status' => $article_status,
- >--->---'highlight' => $style,
- >--->---'showinnernav' => empty($_POST['showinnernav']) ? '0' : '1',
- 'download_url' => htmlspecialchars($_POST['download_url']),
- 'download_size' => htmlspecialchars($_POST['download_size']),
- 'download_type' => htmlspecialchars($_POST['download_type']),
- 'download_official_website' => htmlspecialchars($_POST['download_official_website']),
- 'newgame_url' => htmlspecialchars($_POST['newgame_url']),
- 'newgame_web' => htmlspecialchars($_POST['newgame_web']),
- 'newgame_status' => htmlspecialchars($_POST['newgame_status']),
- 'newgame_f' => htmlspecialchars($_POST['newgame_f']),
- 'newgame_kfs' => htmlspecialchars($_POST['newgame_kfs']),
- 'newgame_yys' => htmlspecialchars($_POST['newgame_yys']),
- 'newgame_ce_time' => intval($_GET['newgame_ce_time']),
- >---);
复制代码 |