加入我们 登录
商乾、智客联盟、淘宝客、打造爆款、淘宝联盟、微信开发、拼多多、京东、电商培训、电商交流基地 返回首页

北极孤星的泪的个人空间 https://www.aurrel.com/?1 [收藏] [复制] [分享] [RSS]

日志

discuz二开常用操作手册

热度 2321已有 1531 次阅读2020-11-15 10:26 |个人分类:我的笔记——技术篇| discuz网站开发

登录
<a href="member.php?mod=logging&action=login" onclick="showWindow('login', this.href);return false;" title="登录">登录</a>

注册
<a href="member.php?mod=register" title="立即注册">立即注册</a>

忘记密码
<a href="javascript:;" onclick="showWindow('login', 'member.php?mod=logging&action=login&viewlostpw=1')" title="找回密码">找回密码</a>

购买邀请码 misc.php?mod=buyinvitecode

JS跳转
onclick="window.location.href='home.php?mod=mobile&do=friend';"

JS更换class的名称
document.getElementById('idname').className='a';
document.getElementById('idname').style.display='block';
document.getElementById("idname").style.marginTop="30px";

批量替换超链接:href="[^"]*"

过滤DZ代码:
preg_replace ("/\[[a-z][^\]]*\]|\[\/[a-z]+\]/i",'',preg_replace("/\[attach\]\d+\[\/attach\]/i",'',$message));

………………………………………………………………………………………………………………………………………………………………

调用单个数据
$qishi = DB::result(DB::query("SELECT qi FROM ".DB::table('jiangchi')." WHERE id = '1'"));

调用统计数据
$qishi = DB::result(DB::query("SELECT count(*) FROM ".DB::table('jiangchi')." WHERE id = '1'"));

单数据表调用
$perpage = 20;
$curpage = empty ( $_GET['page'] ) ? 1 : intval ( $_GET['page'] );
$start = ($curpage-1)*$perpage;
$askcount = DB::result(DB::query("SELECT COUNT(*) FROM ".DB::table('forum_thread')." WHERE fid = '2' AND authorid > 1 AND FROM_UNIXTIME(dateline, '%Y%m%d') = '$jintian'"));
//$asklist
$asklist = array();
if ($askcount) {
$query = DB::query("SELECT * FROM ".DB::table('forum_thread')." WHERE fid = '2' AND displayorder > -1 ORDER BY tid ASC LIMIT $start,$perpage");
while ($value = DB::fetch($query)) {
$asklist[] = $value;
}
}
$multi = multi($askcount, $perpage, $curpage, "portal.php?mod=topic&topic=ask");


多数据表调用
$perpage = 40;
$curpage = empty ( $_GET['page'] ) ? 1 : intval ( $_GET['page'] );
$start = ($curpage-1)*$perpage;
$acount = DB::result(DB::query("SELECT count(*) FROM ".DB::table('forum_forum')." b LEFT JOIN ".DB::table('forum_forumfield')." bf ON bf.fid=b.fid WHERE b.type='sub' AND b.status = 3 AND bf.icon != ''"));
//$alist
$alist = array();
if ($acount) {
$query = DB::query("SELECT bf.*, b.* FROM ".DB::table('forum_forum')." b LEFT JOIN ".DB::table('forum_forumfield')." bf ON bf.fid=b.fid WHERE b.type='sub' AND b.status = 3 AND bf.icon != '' ORDER BY bf.shoplevel DESC, b.commoncredits DESC, bf.fid DESC LIMIT $start,$perpage");
while ($value = DB::fetch($query)) {
$alist[] = $value;
}
}
$multi = multi($acount, $perpage, $curpage, "这里填写跳转地址");

前台数据显示
<!--{loop $alist $key $value}-->
<!--{eval $tupianfm = DB::result(DB::query("SELECT attachment FROM ".DB::table('forum_threadimage')." WHERE tid = '$value[tid]'"));}-->
$value[authorid]
<!--{/loop}-->

取数据表中符合条件的第一条数据
$app=array();
$app=DB::fetch_first("select * from ".DB::table('home_diy_center')." where id='{$id}'");

人性化时间戳
<!--{echo dgmdate(这里填写时间参数, 'u', '9999', getglobal('setting/dateformat'))}-->
<!--{echo date("Y-m/d H:i:s",这里填写时间参数)}-->

截取字符字数
<!--{echo cutstr(这里填写参数,40)}-->

过滤DISCUZ代码
preg_replace ("/\[[a-z][^\]]*\]|\[\/[a-z]+\]/i",'',preg_replace("/\[attach\]\d+\[\/attach\]/i",'',$message));

写入数据库
if(submitcheck('tijiao')) {
$setarr = array(
'tid' => $_GET['topicid'],
'name' => $_POST['name'],
'position' => $_GET['position'],
'dateline' => $_G['timestamp'],
);
DB::insert('forum_poststick', $setarr, 1);
$query = DB::query("UPDATE ".DB::table('forum_thread')." SET stickreply='1' 
WHERE tid='$tid'");
$query = DB::query("DELETE FROM ".DB::table('forum_post')." WHERE pid='$pid'");
showmessage('成功的提示信息', "forum.php?mod=viewthread&tid=$tid");
}

表单提交:
<form action="do.php?op=jiangchi&con=yes" method="post" autocomplete="off">
<input type="hidden" value="{FORMHASH}" name="formhash" />
最低奖金:<input name="qi" type="text" value="$qishi" /> 
最高奖金:<input name="end" type="text" value="$zhzh" />  
<button value="true" name="tijiao" type="submit">提交设置</button>
<input type="hidden" name="tijiao" value="true" />
</form>

以下两个时间格式是对等关系
date("Ymd",time());  20150212
FROM_UNIXTIME(dateline, '%Y%m%d')
前者用于PHP,后者用于数据库调用的字段的格式化

调用图片附件
<!--{eval $biaoid = substr($value[tid], -1); $cover = DB::result(DB::query("SELECT attachment FROM ".DB::table('forum_attachment_'.$biaoid.'')." WHERE tid = '$value[tid]'"));}-->

数据库循环嵌套调用
<!--{eval $slides = DB::fetch_all("SELECT * FROM ".DB::table('a')." WHERE `uid`= $_G[uid] ORDER BY `id` DESC");}-->
<!--{loop $slides $slide}-->
$slide[name]
<!--{/loop}-->

ucenter无法登录:
打开uc_server/model/admin.php
找到第22行的
$this->cookie_status = 0;
改成
$this->cookie_status = isset($_COOKIE['sid']) ? 1 : 0;

无刷新切换li标签并且同时加载框架页面:
<script type="text/javascript"> 
var jq = jQuery.noConflict();
jq(function(){ 
jq("#changemenu>li").mouseover(function(){ 
jq("#changemenu>li").each(function(i){ 
jq(this).removeClass("current"); 
}); 
jq(this).addClass("current"); 
document.getElementById("changenr").innerHTML='<iframe src="chart.php?op=index&id='+jq(this).attr('dataid')+'" height="350" width="1070" frameborder="0" scrolling="no"></iframe>';
}).mouseout(function(){ 
jq(this).addClass("current"); 
}); 
});
</script>
<ul id=“changemenu”>
   <li class=“current” dataid=“1”></li>
   <li dataid=“2”></li>
</ul>
<div id=“changenr”></div>

快速发帖
<a href="forum.php?mod=misc&action=nav" onclick="showWindow('nav', this.href, 'get', 0);">发布新话题</a>

常用词汇
select 选择
count 总数
table 表
where 条件
result 结果
perpage 每页
curpage 当前页
update 更新
delete 删除
insert 写入
dateline 日期
time 时间
echo 输出   <?php   echo '123';   ?>
multi 分页函数
if 如果
else 否则
elseif 
start 起始
limit 限制  limit 10
DESC 倒序
ASC 正序<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>www.banban.so - Database Error</title>
<meta http-equiv="Content-Type" content="text/html; charset=gbk" />
<meta name="ROBOTS" content="NOINDEX,NOFOLLOW,NOARCHIVE" />
<style type="text/css">
<!--
body { background-color: white; color: black; font: 9pt/11pt verdana, arial, sans-serif;}
#container { width: 1024px; }
#message   { width: 1024px; color: black; }

.red  {color: red;}
a:link     { font: 9pt/11pt verdana, arial, sans-serif; color: red; }
a:visited  { font: 9pt/11pt verdana, arial, sans-serif; color: #4e4e4e; }
h1 { color: #FF0000; font: 18pt "Verdana"; margin-bottom: 0.5em;}
.bg1{ background-color: #FFFFCC;}
.bg2{ background-color: #EEEEEE;}
.table {background: #AAAAAA; font: 11pt Menlo,Consolas,"Lucida Console"}
.info {
    background: none repeat scroll 0 0 #F3F3F3;
    border: 0px solid #aaaaaa;
    border-radius: 10px 10px 10px 10px;
    color: #000000;
    font-size: 11pt;
    line-height: 160%;
    margin-bottom: 1em;
    padding: 1em;
}

.help {
    background: #F3F3F3;
    border-radius: 10px 10px 10px 10px;
    font: 12px verdana, arial, sans-serif;
    text-align: center;
    line-height: 160%;
    padding: 1em;
}

.sql {
    background: none repeat scroll 0 0 #FFFFCC;
    border: 1px solid #aaaaaa;
    color: #000000;
    font: arial, sans-serif;
    font-size: 9pt;
    line-height: 160%;
    margin-top: 1em;
    padding: 4px;
}
-->
</style>
</head>
<body>
<div id="container">
<h1>Discuz! Database Error</h1>
<div class='info'>(0) <div class="sql">SELECT phone FROM mobile_login_connection WHERE uid = '5235'</div></div>

<div class="info"><p><strong>PHP Debug</strong></p><table cellpadding="5" cellspacing="1" width="100%" class="table"><tr class="bg2"><td>No.</td><td>File</td><td>Line</td><td>Code</td></tr><tr class="bg1"><td>1</td><td>forum.php</td><td>73</td><td>discuz_database::query(%s)</td></tr><tr class="bg1"><td>2</td><td>source/class/discuz/discuz_database.php</td><td>136</td><td>db_driver_mysql->query(%s, false, false)</td></tr><tr class="bg1"><td>3</td><td>source/class/db/db_driver_mysql.php</td><td>153</td><td>db_driver_mysql->halt(false, %d, %s)</td></tr><tr class="bg1"><td>4</td><td>source/class/db/db_driver_mysql.php</td><td>224</td><td>break()</td></tr></table></div><div class="help"><a href="http://www.banban.so">www.banban.so</a> 已经将此出错信息详细记录, 由此给您带来的访问不便我们深感歉意. <a href="http://faq.comsenz.com/?type=mysql&dberrno=0&dberror=" target="_blank"><span class="red">Need Help?</span></a></div>
</div>
</body>
</html>
评论 (0 个评论)

facelist doodle 涂鸦板

您需要登录后才可以评论 登录 | 加入我们

商乾全球电商人、电商交流学习与电商实战技术分享、电商爬虫、生活交流专业网站
  • 官方手机版

  • 微信公众号

  • 商务合作