个人学习、工作的经验整理!

dedebiz挑错插件不用JS的独立页面调用方法(新手适用)

网站建设 来源:未知 作者:admin

dedebiz的挑错功能是在本页面使用JS跳出弹窗,有的朋友不喜欢用JS,那么就把他改成独立页面(不用js)。

第一步,修改apps/erraddsave.php:

<?php
/**
 * 错误提交
 *
 * @version        $id:erraddsave.php$
 * @package        DedeBIZ.Site
 * @copyright      Copyright (c) 2022 DedeBIZ.COM
 * @license        https://www.dedebiz.com/license
 * @link           https://www.dedebiz.com
 */
require_once(dirname(__FILE__)."/../system/common.inc.php");
require_once(DEDEINC.'/memberlogin.class.php');

$htmltitle = "错误提交";
$dopost = isset($dopost) ? $dopost : "";
$aid = isset($aid) ? intval($aid) : 0;
if(empty($dopost))
{
    $row = $dsql->GetOne(" SELECT `title` FROM `biz_archives` WHERE `id` ='$aid'");
    $title = $row['title'];
    require_once(DEDEROOT."/theme/plus/erraddsave.htm");
}
elseif($dopost == "saveedit")
{
    $cfg_ml = new MemberLogin();
    $title = HtmlReplace($title);
    $type = isset($type) && is_numeric($type) ? $type : 0;
    $mid = isset($cfg_ml->M_ID) ? $cfg_ml->M_ID : 0;
    $err = trimMsg(cn_substr($err,2000),1);
    $oktxt = trimMsg(cn_substr($erradd,2000),1);
    $time = time();
    $query = "INSERT INTO `biz_erradd`(aid,mid,title,type,errtxt,oktxt,sendtime)
                  VALUES ('$aid','$mid','$title','$type','$err','$oktxt','$time'); ";
    $dsql->ExecuteNoneQuery($query);
    ShowMsg("谢谢您对本网站的支持,我们会尽快处理您的建议!","javascript:window.close();");
    exit();
}  
else {
    echo json_encode(array(
        "code" => -1,
        "data" => null,
        "msg" => "未知方法",
    ));
    exit;
}

第二步,在/theme/plus/目录下添加erraddsave.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=<?php echo $cfg_soft_lang; ?>" />
<title><?php echo $cfg_webname;?>_挑错</title>
<link href="<?php echo $cfg_templets_skin; ?>/style/dedecms.css" rel="stylesheet" type="text/css" media="screen" />
</head>
<body class="flinkpage">

<div class="header">
	<div class="top w960 center">
		<div class="title">
            <h1><a href="<?php echo $cfg_basehost;?>"><img src="<?php echo $cfg_templets_skin; ?>/images/logo.gif" height="40" width="233" <div class="formbox">
<form action="erraddsave.php"  method="post" name="feedback">
     <input type='hidden' name='dopost' value='saveedit'>
     <input type="hidden" name="title" value="<?php echo $title?>" />
     <input type="hidden" name="aid" value="<?php echo $aid?>" />
<table width="100%" align="center" cellpadding="0" cellspacing="0" bgcolor="#cccccc">
	<tr>
		<td width="100" height="30" align="right" bgcolor="#FFFFFF">标题:</td>
        <td bgcolor="#FFFFFF"><?php echo $title;?></td>
	</tr>
    <tr>
    	<td height="30" align="right" bgcolor="#FFFFFF">错误类型:</td>
        <td bgcolor="#FFFFFF">
        	<select name="type">
            	<option value="1">错别字(除的、地、得)</option>
                <option value="2">成语运用不当</option>
				<option value="3">专业术语写法不规则</option>
				<option value="4">产品与图片不符</option>
				<option value="5">事实年代以及内容错误</option>
				<option value="6">技术参数错误</option>
				<option value="7">其他</option>
   	    </select>        </td>
    </tr>
    <tr>
    	<td align="right" bgcolor="#FFFFFF">
        	错误内容:        </td>
        <td bgcolor="#FFFFFF"><textarea name="err" cols="40" rows="4" class="ipt-txt"></textarea></td>
    </tr>
    <tr>
    	<td align="right" bgcolor="#FFFFFF">
        	修正建议:       </td>
        <td bgcolor="#FFFFFF">
        	<textarea name="erradd" cols="40" rows="4" class="ipt-txt"></textarea>        </td>
    </tr>
    <tr>
    	<td height="35" align="center" bgcolor="#FFFFFF">&nbsp;</td>
    	<td bgcolor="#FFFFFF"><input name="提交" type="submit" value="提交" class="btn-2"/>
          <input name="重置" type="reset" value="重置" class="btn-2"/></td>
      </tr>
</table>
</form>
<br />
    </div>

</div>



<!-- //底部模板 -->

</body>
</html>

最后,在文章中引用错误代码:任选一条。

  <a href="{dede:field name='phpurl'/}/erraddsave.php?aid={dede:field.id/}&title={dede:field.title/}">挑错1</a>
  <a href="{dede:field name='phpurl'/}/erraddsave.php?aid={dede:field.id/}, '{dede:field.title/}'">挑错2</a>

 


答案有错 or 我有答案