dedecms基础2012

来源:互联网 发布:冠能狗粮网络代理 编辑:程序博客网 时间:2024/05/29 16:03

会员头部

<div id="_userlogin">
      <div class="userlogin"><ul><li><a href="/member/reg_new.php">免费注册</a></li><li><span>|</span></li><li><a href="/member/login.php">登录</a></li>      <li><span>|</span></li></ul>      </div>     </div>ajax_loginsta.php  顶部调用Js<script language="javascript" type="text/javascript" src="{dede:global.cfg_cmsurl/}/include/dedeajax2.js"></script><script language="javascript" type="text/javascript">function CheckLogin(){  var taget_obj = document.getElementById('_userlogin');  myajax = new DedeAjax(taget_obj,false,false,'','','');  myajax.SendGet2("{dede:global.cfg_cmspath/}/member/ajax_loginsta.php");  DedeXHTTP = null;}</script>

点击栏目直接跳转到第一篇文章

<meta http-equiv="refresh" content="0; url={dede:arclist typeid='' row='1' }[field:arcurl/]{/dede:arclist}" />

摘要数字增加

改数据库
alter table dede_archives alter column description varchar(600)
改后台系统参数 其他选项
改dede/article_edit.php  里面的250改数字

文章页

<!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=utf-8" /><title>{dede:field.title/}_{dede:global.cfg_webname/}</title><meta name="keywords" content="{dede:field name='keywords'/}" /><meta name="description" content="{dede:field name='description' function='html2text(@me)'/}" /><link rel="stylesheet" type="text/css" href="{dede:global.cfg_templets_skin/}/css/css.css"/></head><body>{dede:include filename="head.html"/}栏目名称 {dede:field.typename/}栏目位置 {dede:field name='position'/}栏目链接 {dede:field.typelink/}文章标题 {dede:field.title/}文章日期 {dede:field.pubdate function="MyDate('Y-m-d H:i',@me)"/}            {dede:field.senddate function="MyDate('Y-m-d H:i',@me)"/}文章缩略图<img src="{dede:field name='litpic'/}"  >文章内容 {dede:field.body/}文章分页 {dede:pagebreak/}文章关键字 {dede:field.keywords /}文章简介 {dede:field.description function='html2text(@me)'/}文章来源  {dede:field name='source'/}文章作者 {dede:field.writer/}文章tag {dede:tag type='current'/}文章点击 <script src="{dede:field name='phpurl'/}/count.php?aid={dede:field name='ID'/}&mid={dede:field name='memberid'/}&view=yes" language="javascript"></script>            <script src="{dede:field name='phpurl'/}/count.php?view=yes&aid={dede:field name='id'/}&mid={dede:field name='mid'/}" type='text/javascript' language="javascript"></script>能用栏目的缩略图<img src="{dede:field name='typeid' runphp='yes'}$id=@me;global $dsql;$sql="select seotitle from dede_arctype where id=$id";$row=$dsql->getOne($sql);@me=$row["seotitle"];{/dede:field}" height="38">{dede:field name='typeid' runphp='yes'}$id=@me;global $dsql;$sql="select content from dede_arctype where id=$id";$row=$dsql->getOne($sql);@me=$row["content"];{/dede:field}上一篇 {dede:prenext get='pre'/}下一篇 {dede:prenext get='next'/}相关文档{dede:likearticle row='4' titlelen='24' mytypeid=3 eregtype=all|tag|keyword} [field:title/] {/dede:likearticle} {dede:likeart titlelen='24' row='10'} [field:title/] {/dede:likearticle} 图片滑过变色<img class="imgborder" width="358" height="248" src="{dede:field.seotitle /}" border="0" style="filter:progid:DXImageTransform.Microsoft.BasicImage(grayscale=1)" onmouseover="this.style.filter='progid:DXImageTransform.Microsoft.BasicImage(grayscale=0)'" onmouseout="this.style.filter='progid:DXImageTransform.Microsoft.BasicImage(grayscale=1)'"/></body></html>

头部

<a href="#" class="hrefs" onclick="this.style.behavior='url(#default#homepage)';this.setHomePage('http://www.baidu.com');">设为首页</a><a href="javascript:window.external.AddFavorite('http://www.baidu.com', '百度')">加入收藏</a>所有栏目(网站地图可以用){dede:channelartlist typeid='top'}<li><a href="{dede:field name='typeurl'/}"><strong>{dede:field name='typename'/}</strong></a></li>{dede:channel type='son' noself='yes'}<li><a href="[field:typelink/]">[field:typename/]</a></li>{/dede:channel}{/dede:channelartlist}顶级栏目<ul><li{dede:field name=typeid runphp="yes"}(@me=="")? @me=" id='this'":@me="";{/dede:field}><a href="/"><span>首页</span></a></li>{dede:channel type='top' row='10' currentstyle="<li id='this'><a href='~typelink~' ><span>~typename~</span></a></li>"}  <li><a href='[field:typeurl/]'><span>[field:typename/]</span></a></li>  {/dede:channel}    </ul>调用指定栏目链接{dede:type typeid='6'} <a href='[field:typelink /]' target="_blank"   >更多</a> {/dede:type}某个栏目的二级栏目{dede:channelartlist typeid='2,2'}{dede:channel type='son' noself='yes'}<a href="[field:typelink/]">[field:typename/]</a>{/dede:channel}{/dede:channelartlist}调用某个栏目下的二级栏目名字{dede:channel type='son' typeid='3' row='16'}<a href='[field:typelink/]'>[field:typename/]</a><br />{/dede:channel}子栏目调用标签:{dede:channel type=son typeid=6 noself=yes} [field:typename/] {/dede:channel} 一级导航{dede:channel type='top' row='10' }         <a href='[field:typeurl/]' [field:rel/]>[field:typename/]</a>{/dede:channel}指定栏目的二级导航{dede:channelartlist typeid='1,1'}{dede:channel type='son' noself='yes'}<a href="[field:typelink/]">[field:typename/]</a>{/dede:channel}{/dede:channelartlist}导航条:{dede:channel type='top' row='10′>~typename~"} [field:typename/] {/dede:channel} 德天数码的{dede:channelartlist typeid='2'}<li class="nydalei"><a href="{dede:field name='typeurl'/}">{dede:field name='typename'/}</a></li>{dede:channel type='son' noself='yes'}<li class="nyxiaolei"><a href="[field:typelink/]">[field:typename/]</a></li>{/dede:channel}{/dede:channelartlist}每个栏目就每个的二级栏目{dede:channel type='son' typeid='' row='16' currentstyle="<li class='thisleft'><a href='~typelink~' ~rel~><span>~typename~</span></a></li>"}<li><a href='[field:typelink/]'><span>[field:typename/]</span></a></li>{/dede:channel}{dede:channel type='son' typeid='' row='16' currentstyle="<li><a href='~typelink~' id='thisleft'>~typename~</a></li>"}<li><a href='[field:typelink/]'>[field:typename/]</a></li>{/dede:channel}{dede:channelartlist row=6}<a href='{dede:field name='typeurl'/}'>{dede:field name='typename'/}</a>{dede:channel type='son' row='10' currentstyle="<li class='hover'><a href='~typelink~' ~rel~><span>~typename~</span></a></li>"}<a href='[field:typeurl/]' [field:rel/]>[field:typename/]</a>{/dede:channel}{/dede:channelartlist}栏目导航调用标签: <a href="/">首页</a></li>{dede:channel type='top' row='8' currentstyle="<li class='thisclass'><a href='~typelink~'>~typename~</a> </li>"}<li><a href='[field:typelink/]' target="_blank">[field:typename/]</a> </li>{/dede:channel}频道栏目调用标签: {dede:channel type='self'}<li><a href='[field:typelink/]'>[field:typename/]</a></li>{/dede:channel}某个栏目下的二级栏目列表 还有数字{dede:channelartlist typeid='4,4' row='4'}{dede:channel type='son' noself='yes'}                    <DIV class=hota_on id=fhnew[field:global name=autoindex runphp="yes"]@me=@me+1;[/field:global]  onmouseover="show_intro('yulenew','fhnew',4,[field:global name=autoindex runphp="yes"]@me=@me+1;[/field:global],'hota')"  style="FLOAT: left; MARGIN-LEFT: 1px"><DIV class=touch-tab><H3><A  href="[field:typelink/]" >[field:typename/] </A></H3></DIV></DIV>{/dede:channel}{/dede:channelartlist}</TD><TD class=R width=3></TD></TR><TR><TD class=middle width=760 colSpan=3 height=126>某个栏目下的二级栏目的文章列表 还有数字还有判断{dede:channelartlist typeid=4}<DIV id=yulenew{dede:global.itemindex/}{dede:global.itemindex runphp='yes'}if(@me  == 1){@me = '';}else{@me = ' style="DISPLAY: none"';}{/dede:global.itemindex} align=left>{dede:arclist row=5 titlelen=20 orderby=pubdate } <div class=product><div class=productpic><a href=[field:arcurl/]><img src=[field:picname/] width="130" height="100" ></a></div><div class=producttext><a href=[field:arcurl/]>[field:title/]</a></div></div>{/dede:arclist}</DIV>{/dede:channelartlist}arclist            标签下使用 [field:global.autoindex/] 默认从1开始channel         标签下使用 [field:global.autoindex/] 默认从0开始channelartlist 标签下使用 {dede:global.itemindex/}  默认从1开始arclist  从0开始 [field:global name=autoindex runphp="yes"]@me=@me-1;[/field:global]channel  从1开始 [field:global name=autoindex runphp="yes"]@me=@me+1;[/field:global]channelartlist  从0开始 {dede:global name=itemindex runphp='yes'}@me=@me-1;{/dede:global}<form  name="formsearch" action="/plus/search.php"><input type="hidden" name="kwtype" value="0" /><input type="text" class="kuang" value="请输入关键字..." name="q"  onClick="this.value=''"><input name="imageField" type="image" src="/templets/hxls/images/searchzi.gif" width="87" height="33" border="0"></form><strong>热门关键词</strong>:{dede:hotwords num='7' subday='100' maxlength='32'/}高级搜索链接/plus/heightsearch.php<iframe  src="sybanner.html" scrolling="no" frameborder="0" width=100% height=402  allowTransparency="true" ></iframe>旧版flash代码<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="169" height="141">      <param name="movie" value="/templets/sanmenx/images/flash/r{dede:global.itemindex/}.swf" />      <param name="quality" value="high" />      <param name="wmode" value="transparent" />      <embed src="/templets/sanmenx/images/flash/r{dede:global.itemindex/}.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="169" height="141"></embed>    </object>

搜索页

<!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=utf-8" /><title>{dede:global name='keyword' function='RemoveXSS(@me)'/}_{dede:global.cfg_webname/}</title><meta name="keywords" content=" {dede:global name='keyword' function='RemoveXSS(@me)'/}" /><link rel="stylesheet" type="text/css" href="{dede:global.cfg_templets_skin/}/css/css.css"/><meta name="description" content=" {dede:global name='keyword' function='RemoveXSS(@me)'/}" /></head><body>{dede:include filename="head.html"/}位置 搜索{dede:global name='keyword' function='RemoveXSS(@me)'/}的结果{dede:list pagesize=10 }  标题 <a href='[field:arcurl/]'  target="_blank">[field:title/]</a>日期 [field:stime/] 点击 [field:click/]简介 [field:description/]...       [field:description function='cn_substr(@me,310)'/][field:title/] [field:pubdate function="GetDateMK(@me)"/]  [field:description/]…{/dede:list} 分页{dede:pagelist listitem="info,index,end,pre,next,pageno,option" listsize="5"/}</body></html>
首页

<!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=utf-8" /><title>{dede:global.cfg_webname/}</title><meta name="keywords" content="{dede:global.cfg_keywords/}" /><meta name="description" content="{dede:global.cfg_description/}" /><link rel="stylesheet" type="text/css" href="{dede:global.cfg_templets_skin/}/css/css.css"/><script type="text/javascript" src="css/js.js"></script></head><body> {dede:include filename="head.htm"/} {dede:include filename="lunhuan.htm"/} {dede:include filename="../../a/newfile1.html"/}  <img src="/templets/ydjj/images/gyyd.gif" width="110" height="46">  普通列表 {dede:arclist typeid=2  row=8 titlelen=60 orderby=pubdate } <img src="[field:picname/]" >  [field:litpic/]<a href="[field:arcurl/]" >[field:title/]</a> <a href='[field:arcurl/]' title='[field:fulltitle/]'>[field:title/]</a>[field:pubdate function="GetDateMK(@me)"/][field:description function='cn_substr(@me,310)'/][field:senddate function="GetDateMK(@me)"/]{/dede:arclist}{dede:arclist typeid=10  row=11 titlelen=60 orderby=weight } 所有参数的列表{dede:arclist  flag='h' typeid='' row='' col='' titlelen='' infolen='' imgwidth='' imgheight='' listtype='' orderby='click'  orderway='asc'  keyword='' limit='0,1'} <a href='[field:arcurl/]' title='[field:fulltitle/]'>[field:title/]</a>{/dede:arclist} 参数 推荐  flag='c'  不推荐 noflag='c'头条[h]推荐[c]幻灯[f]特荐[a]滚动[s]加粗[b]图片[p]跳转[j] col 分多少列有附加表的值时{dede:arclist row='8'  addfields='filetype,language,softtype' channelid='3'} [field:textlink /] - [field:softtype /] {/dede:arclist} 单页的{dede:sql sql='Select content from dede_arctype where id=1'}[field:content function=cn_substr(html2text(@me),400) /][field:content/] {/dede:sql}   第一条和其他条不一样的{dede:arclist  typeid=8 limit='0,1' titlelen=40  orderby='pubdate'}<a href="[field:arcurl/]" >[field:title/]</a>{/dede:arclist}{dede:arclist  typeid=8 limit='1,5' titlelen=50 orderby='pubdate'}<a href="[field:arcurl/]" >[field:title/]</a>{/dede:arclist}自定义表单列表{dede:loop table='dede_diyform1'  row='10' } <li><a href='/plus/diy.php?action=list&diyid=1' >[field:biaoti/]</a></li>{/dede:loop}友情链接{dede:flink type='image' row='16'}  [field:link /] {/dede:flink}{dede:flink type='text' typeid='1'  row='100'}[field:link /]{/dede:flink}{dede:flink row='4' type='text' titlelen='50' typeid='0'}[field:link /]{/dede:flink}{dede:flink type='textall' row='24'} [field:link /] {/dede:flink}友情链接改样式在\include\taglib\flink.lib.php 里网站底部技术支持:<a href="http://www.e0311.net" target="_blank">聚思网络</a>{dede:global.cfg_powerby/}tag 调用:{dede:tag row=8 getall=1 sort='month'} [field:tag /] {/dede:tag} 评论调用{dede:feedback row='5' titlelen='24' infolen='80'}评论的人 <a href="#" class="username">[field:username function="(@me=='guest' ? '游客' : @me)"/]</a> 评论的文章标题 <a href="[field:global.cfg_phpurl/]/feedback.php?aid=[field:aid/]" class="title">[field:title/]</a>评论的内容 [field:msg/]{/dede:feedback}arclist            标签下使用 [field:global.autoindex/] 默认从1开始channel         标签下使用 [field:global.autoindex/] 默认从0开始channelartlist 标签下使用 {dede:global.itemindex/}  默认从1开始arclist  从0开始 [field:global name=autoindex runphp="yes"]@me=@me-1;[/field:global]channel  从1开始 [field:global name=autoindex runphp="yes"]@me=@me+1;[/field:global][field:typename/]channelartlist  从0开始 {dede:global name=itemindex runphp='yes'}@me=@me-1;{/dede:global}</body></html>

列表页

<!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=utf-8" /><title>{dede:field.title/}_{dede:global.cfg_webname/}</title><meta name="keywords" content="{dede:field name='keywords'/}" /><meta name="description" content="{dede:field name='description' function='html2text(@me)'/}" /><link rel="stylesheet" href="{dede:global.cfg_templets_skin/}/css/css.css" /></head><body>{dede:include filename="head.htm"/}栏目名称 {dede:field.title/} {dede:field.typename/}栏目内容 {dede:field.content/}所在位置 {dede:field name='position'/} 列表 {dede:list pagesize='10'  titlelen='30'}  标题 <a href="[field:arcurl/]" >[field:title/]</a> <a href='[field:arcurl/]' title='[field:fulltitle/]'>[field:title/]</a>图片 <img src="[field:picname/]">日期  [field:pubdate function="GetDateMK(@me)"/][field:pubdate function='strftime("%y-%m-%d",@me)'/] [field:pubdate function='strftime("%Y-%m-%d %H:%M:%S",@me)'/] 描述  [field:description/]…       [field:description function='cn_substr(@me,310)'/]作者  [field:writer/]数字排列  [field:global name=autoindex /]   内容 [field:id runphp='yes'] $aid = @me; $row = $GLOBALS['dsql']->GetOne("Select body From `dede_addonarticle` where aid='$aid' "); @me = "{$row['body']}";[/field:id]   {/dede:list}分页 {dede:pagelist listitem="info,index,end,pre,next,pageno,option" listsize="5"/}当天的有new[field:pubdate runphp='yes']$aa=strftime('%m-%d',@me);$ntime = time();$tagtime = @me;$day3 = 3600 * 24;if($tagtime > $ntime-$day3) @me = "<img src='/images/new.gif' />";else @me = '';[/field:pubdate]列表分行的{dede:list pagesize="20" titlelen="60" orderby="pubdate" typeid=""}[field:global runphp='yes' name=autoindex]      $a="<div id='a'>";      $b="<div id='b'>";      if ((@me%2)==0) @me=$a;      else @me=$b;      [/field:global]<a  href='[field:arcurl/]'>[field:title/]</a></div>{/dede:list}列表有自定义字段时 {dede:list pagesize="20" titlelen="60" orderby="pubdate" addfields='xsxz,kksj,skdd,fujian' channelid='1' }</body></html>

单页

<!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=utf-8" /><title>{dede:field.typename/}_{dede:global.cfg_webname/}</title><title>{dede:field.title/}_{dede:global.cfg_webname/}</title><meta name="keywords" content="{dede:field name='keywords'/}" /><meta name="description" content="{dede:field name='description' function='html2text(@me)'/}" /><link rel="stylesheet" type="text/css" href="{dede:global.cfg_templets_skin/}/css/css.css"/> <img src="/templets/ydjj/images/gyyd.gif" width="110" height="46"></head><body>{dede:include filename="head.htm"/}栏目名称 {dede:field.typename/}栏目名称有大分类的 {dede:field.title/}栏目位置 {dede:field name='position'/}栏目内容 {dede:field.content/}</body></html>



不少朋友需要在DedeCms的问答系统、留言本、会员空间导航里调用系统标签,但默认是不支持系统标签调用的,需要对系统文件进行简单的修改。
      第一步:打开”/include/common.func.php”,该文件5.6版本默认存在,5.5的不存在自己建一个。
      然后在该文件中加入一个函数,代码如下:
function pasterTempletDiy($path)
{
  require_once(DEDEINC.”/arc.partview.class.php”);
  global $cfg_basedir,$cfg_templets_dir;
  $tmpfile = $cfg_basedir.$cfg_templets_dir.”/”.$path;//模版文件的路径
  $dtp = new PartView();
  $dtp->SetTemplet($tmpfile);
  $dtp->Display();
}
      第二步,打开留言本的模版文件,默认的是/templets/plus/guestbook.htm
      用以下代码替换原因的调用头部代码<?php
pasterTempletDiy(“default/head.htm”);
?>
      DedeCms的问答及会员空间导航,按上边的方法即可。

sql语句

替换

update  pwn_shop_con set body = replace(body, 'shengbaolong360', 'panzhentang') 

update 表名 set 字段名=replace(cast(与前面一样的字段名 as varchar(8000)) ,'原本内容','想要替换成什么') 

update [表名] set 字段名 = replace(与前面一样的字段名,'原本内容','想要替换成什么') 

改标题字数多一点(这个设置完 还要在后台系统管理里设置下字数)
alter table dede_archives alter column title char(120)

alter table dede_archives alter column title char(120)

defaultname 

栏目名称 字数多一点

alter table dede_arctype modify column typename char(255)
alter table dede_arctype modify column typedir char(255)

文章摘要多一点字

alter table dede_archives alter column description varchar(600)

网站地图_{dede:global.cfg_webname/}

{dede:global name='maplist'/}

singlepage.html

{dede:field name='body'/}

lunhuan.html

<script language='javascript'>linkarr = new Array();picarr = new Array();textarr = new Array();var swf_width=322;var swf_height=255;//文字颜色|文字位置|文字背景颜色|文字背景透明度|按键文字颜色|按键默认颜色|按键当前颜色|自动播放时间|图片过渡效果|是否显示按钮|打开方式var configtg='0xf5f5f5|1|0x80622c|5|0xffffff|0xC5DDBC|0xf98030|5|2|1|_blank';   var files = "";   var links = "";   var texts = "";   //这里设置调用标记   {dede:arclist typeid=14 row=4 titlelen=40 orderby='pubdate' flag='f' }  linkarr[[field:global.autoindex/]] = "[field:arcurl/]";picarr[[field:global.autoindex/]] = "[field:litpic/]";textarr[[field:global.autoindex/]] = "[field:title function='html2text(@me)'/]";{/dede:arclist}   for(i=1;i<picarr.length;i++){   if(files=="") files = picarr[i];   else files += "|"+picarr[i];   }   for(i=1;i<linkarr.length;i++){   if(links=="") links = linkarr[i];   else links += "|"+linkarr[i];   }   for(i=1;i<textarr.length;i++){  if(texts=="") texts = textarr[i];  else texts += "|"+textarr[i];}document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase=" http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="'+ swf_width +'" height="'+ swf_height +'">');   document.write('<param name="movie" value="{dede:global.cfg_templeturl /}/default/images/bcastr3.swf"><param name="quality" value="high">');   document.write('<param name="menu" value="false"><param name=wmode value="opaque">');   document.write('<param name="FlashVars" value="bcastr_file='+files+'&bcastr_link='+links+'&bcastr_title='+texts+'&bcastr_config='+configtg+'">');   document.write('<embed src="{dede:global.cfg_templeturl /}/default/images/bcastr3.swf" wmode="opaque" FlashVars="bcastr_file='+files+'&bcastr_link='+links+'&bcastr_config='+configtg+'&menu="false" quality="high" width="'+ swf_width +'" height="'+ swf_height +'" type="application/x-shockwave-flash" pluginspage=" http://www.macromedia.com/go/getflashplayer" />'); document.write('</object>');  </script>
图片列表
{dede:list pagesize='6'}<li><table width="931" height="112" border="0" cellpadding="0" cellspacing="0">  <tr>    <td rowspan="3" valign="top" class="list_pic"><a href="[field:arcurl/]" ><img src="[field:picname/]" width="179" height="108" border="0"></a></td>    <td class="list_title"><a href="[field:arcurl/]" >[field:title/]</a></td>    <td class="list_riqi" >[field:pubdate function="GetDateMK(@me)"/]</td>  </tr>  <tr>    <td colspan="2" class="list_con">[field:description function='cn_substr(@me,310)'/]</td>    </tr>  <tr>    <td> </td>    <td class="list_more"><a href="[field:arcurl/]" >more</a></td>  </tr></table></li>{/dede:list}
内页侧边栏

<div class="nyleft"><div class="nyl_ban">{dede:field.title  runphp='yes'}list($toptype,$sontype)=split('/',@me);@me=$toptype;{/dede:field.title}</div><div class="nyl_con"><ul>{dede:channel type='son' typeid='' row='16' currentstyle="<li id='thisleft'><a href='~typelink~' ~rel~><span>~typename~</span></a></li>"}<li><a href='[field:typelink/]'><span>[field:typename/]</span></a></li>{/dede:channel}</ul></div></div>

dede自定义表单添加验证码

织梦dedecms网站给自定义表单加dede模板自带验证码的方法。


有时候,我们因为需要给dede网站的自定义表单添加验证码,防止恶意填写表单提交。


我们可以用以下的方法来实现:


首先,我们要找到 /plus/diy.php 这个文件


在头部引入文件:


require_once(DEDEINC.'/membermodel.cls.php');


然后找到


elseif($do == 2)


    {  在这个地方加入代码块  


       //验证码验证


        $svali = GetCkVdValue();


         if(preg_match("/1/",$safe_gdopen)){


             if(strtolower($vdcode)!=$svali || $svali=='')


             {


                 ResetVdValue();


                 ShowMsg('验证码错误!', '-1');


                 exit();


             }  


         }


修改好后保存一下文件。


第二步:在使用验证码的自定义表单静态页面中插入代码块


 


<input type="text" class="intxt w200 code" style="width: 50px; text-transform: uppercase;" id="vdcode" name="vdcode"/>
<img id="vdimgck" align="absmiddle" onclick="this.src=this.src+'?'" style="cursor: pointer;" alt="看不清?点击更换" src="/include/vdimgck.php"/> 看不清? <a href="javascript:void(0)" onclick="changeAuthCode();">点击更换</a>


在这个静态页面里还得引用JQuery


再加入 JS代码块


<script type="text/javascript"> 
 $ = jQuery;  
 function changeAuthCode() {  
 var num = new Date().getTime();  
 var rand = Math.round(Math.random() * 10000);  
 num = num + rand;  
 $('#ver_code').css('visibility','visible');  
 if ($("#vdimgck")[0]) {  
 $("#vdimgck")[0].src = "../include/vdimgck.php?tag=" + num;  
 }  
 return false;  
 }  
 </script>


好了,现在试一试,是不是可以实现验证码的提交了?一个简单的dedecms自定义表单dede模板自带验证码的功能就实现了。


关于自定义表单怎么在模板页中使用这里就不多说了哦!

admin加密

admin 16位 32位加密结果 


admin 的MD5加密代码:


16位加密:7a57a5a743894a0e
32位加密:21232f297a57a5a743894a0e4a801fc3


dede 20位加密:f297a57a5a743894a0e4




admin888的MD5加密码


16位:469e80d32c0559f8
32位:7fef6171469e80d32c0559f88b377245

原创粉丝点击