分享:织梦问答模块可以在后台修改问答和答案
导读:DEDE技术
找了很久的修改问答系统的方法,就是站长在网站后台就可以修改问题和答案的方法,现在分享给大家,用的到的好评一下。
1.把ask/include/asktype.inc.php复制到dede/inc/里面去
2.修改/dede/ask_type第91行
把$sql = "update `dede_asktype` set name='$name', reid='$reid', disorder='$disorder' where id='$id' ";
改成$sql = "update `dede_asktype` set name='$name', reid='$reid', disorder='$disorder',keywords='$keywords',description='$description',title='$title' where id='$id' ";
现在在asktype表里面新增 keywords, description , title三个字段
3.在dede/新建modify_ask.php文件,代码如下:
<?phprequire_once(dirname(__FILE__)."/config.php");require_once(DEDEINC.'/datalistcp.class.php');//问题分类require_once DEDEADMIN.'/inc/asktype.inc.php';$dlist = new DataListCP();$sql = "select * from `dede_ask` where id='".intval($askid)."'";$row = $dsql->GetOne($sql);if($item == 'mod_ask'){ include(DEDEADMIN."/templets/modify_ask.htm");}else if($item == 'revert'){$sql = "select * from `dede_askanswer` where askid='".intval($askid)."'";$answerArr = $dsql->GetOne($sql);include(DEDEADMIN."/templets/ask_revert.htm");}exit;?>
4.在dede/ templets/新建modify_ask.htm文件
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312" /><link href="http://viscms.blog.163.com/blog/img/base.css" rel="stylesheet" type="text/css" /><title>修改问题</title><script language="javascript" src="http://viscms.blog.163.com/blog/js/jquery.js"></script><script language="javascript">function showSub(reid){$.getJSON("subTypes.php?reid="+reid, func织梦模板tion(data){$('#sctTid2').empty(); $.each(data,function(i,row){$('#sctTid2').append("<option value='"+row.id+"'>"+ row.name + "</option>");}); }); }</script></head><body><div><form action="ask_admin.php" method="post" name="form1"><input type="hidden" value="modify" name="action" /><input type="hidden" value="<?php echo $row['id'];?>" name="askid" /><table width="420" height="125" border="0" cellpadding="0" cellspacing="0" style="margin-top:15px;"><tr height="35"><td width="103" align="right">提问者ID:</td><td width="133"><?php echo $row['id'];?></td></tr><tr height="35"><td align="right">所属栏目:</td><td><label><select name="ClassLevel1" onchange="showSub($(this).val())"><?php foreach($asktypes as $t1){if($t1['reid'] == '0'){if($row['tid'] == $t1['id']){$selected = "selected='selected'"; echo "<option value='".$t1['id']."' ".$selected.">".$t1['name']."</option>";}else{echo "<option value='".$t1['id']."'>".$t1['name']."</option>";} } }?></select></label> <label><select name="ClassLevel2" id="sctTid2"><?php foreach($asktypes as $t2){ if($t2['reid'] == $row['tid']){ if($row['tid2'] == $t2['id']){ $selected = "selected='selected'"; echo "<option value='".$t2['id']."' ".$selected.">".$t2['name']."</option>";}else{echo "<option value='".$t2['id']."'>".$t2['name']."</option>";}}}?></select></label></td></tr><tr height="35"><td align="right">提问标题:</td><td><input name="title" type="text" size="52" height="25" value="<?php echo $row['title'];?>" /></td></tr><tr height="35"><td align="right">补充说明:</td><td><textarea name="content" cols="50" rows="6"><?php echo $row['content'];?></textarea></td></tr><tr height="35"><td align="right"> </td><td><label><input type="submit" name="Submit" value="修改" /></label><label><input name="cancel" type="reset" id="cancel" value="重置" /></label></td></tr><tr height="35"><td align="right"> </td><td> </td></tr></table></form></div></body></html>5.在dede/templets/新建ask_revert文件
声明: 本文由我的SEOUC技术文章主页发布于:2023-07-22 ,文章分享:织梦问答模块可以在后台修改问答和答案主要讲述问答,后台,织梦网站建设源码以及服务器配置搭建相关技术文章。转载请保留链接: https://www.seouc.com/article/web_34367.html