2017-8-31 2174 0
源码

给织梦添加复制文档的功能步骤如下:一、打开templets下的content_list.htm找到这一行:<ahref="javascript:;"onClick="moveArc(event,this,<?phpecho(empty($channelid)?0:$channelid);?>)"class="coolbg">&nbsp;移动&nbsp;</a>在这一行的下方添加:<ahref="javascript:;"onClick="copyArc(event,this,<?phpecho(empty($channelid)?0:$channelid);?>);"class="coolbg">&nbsp;复制&nbsp;</a>二、打开dede/js/list.js找到moveArc这个函数functionmoveArc(e,obj,cid){varqstr=getCheckboxItem();if(qstr==''){alert('必须选择一个或多个文档!');return;}LoadQuickDiv(e,'archives_do.php?dopost=moveArchives&qstr='+qstr+'&channelid='+cid+'&rnd='+Math.random(),'moveArchives','450px','180px');ChangeFullDiv('show');}然后在下方添加copyArc这个函数functioncopyArc(e,obj,cid){varqstr=getCheckboxItem();if(qstr==''){alert('必须选择一个或多个文档!');return;}LoadQuickDiv(e,'archives_do.php?dopost=copyArchives&qstr='+qstr+'&channelid='+cid+'&rnd='+Math.random(),'copyArchives','450px','180px');ChangeFullDiv('show');}三、打开dede/archives_do.php找到elseif($dopost=='moveArchives'){这句代码然后在这个大括弧结尾处也就是在433行左右添加如下代码:/*-----------------------------functioncopyArchives(){}------------------------------*/elseif($dopost=='copyArchives'){CheckPurview('sys_ArcBatch');if(empty($totype)){require_once(DEDEINC.'/typelink.class.php');if(!empty($aid)&&empty($qstr))$qstr=$aid;AjaxHead();$channelid=empty($channelid)?0:$channelid;$tl=newTypeLink($aid);$typeOptions=$tl->GetOptionArray(0,$admin_catalogs,$channelid);$typeOptions="<selectname='totype'style='width:90%'><optionvalue='0'>请选择复制到的位置...</option>\r\n$typeOptions</select>";//输出AJAX可移动窗体$divname='copyArchives';echo"<divclass='title'onmousemove=\"DropMoveHand('{$divname}',225);\"onmousedown=\"DropStartHand();\"onmouseup=\"DropStopHand();\">\r\n";echo"<divclass='titLeft'>复制文档</div>\r\n";echo"<divclass='titRight'><imgsrc='images/ico-close.gif'style='cursor:pointer;'onclick='HideObj(\"{$divname}\");ChangeFullDiv(\"hide\");'alt='关闭'title='关闭'/></div>\r\n";echo"</div>\r\n";echo"<formname='quickeditform'action='archives_do.php'method='post'>\r\n";echo"<inputtype='hidden'name='dopost'value='{$dopost}'/>\r\n";echo"<inputtype='hidden'name='qstr'value='{$qstr}'/>\r\n";echo"<tablewidth='100%'style='margin-top:6px;z-index:9000;'>\r\n";?><trheight='28'><tdwidth="80"class='bline'>&nbsp;目标栏目:</td><tdclass='bline'><?phpecho$typeOptions;?></td></tr><trheight='32'><tdwidth="80"class='bline'>&nbsp;文档ID:</td><tdclass='bline'><inputtype='text'name='tmpids'value="<?phpecho$qstr;?>"style='width:310px;overflow:hidden;'/><br/>复制到的目标栏目必须和选定的文档频道类型一致,否则程序会自动勿略不符合的文档。</td></tr><trheight='32'><tdcolspan='2'align='center'style='padding-top:12px'><inputname="imageField"type="image"src="images/button_ok.gif"width="60"height="22"class="np"border="0"style="cursor:pointer"/>&nbsp;&nbsp;<imgsrc="images/button_back.gif"width="60"height="22"border="0"onclick='HideObj("<?phpecho$divname;?>");ChangeFullDiv("hide");'style="cursor:pointer"/></td></td></tr></table></form><?php//AJAX窗体结束}else{$totype=preg_replace("#[^0-9]#",'',$totype);$typeInfos=$dsql->GetOne("SELECTtp.channeltype,tp.ispart,tp.channeltype,ch.maintable,ch.addtable,ch.issystemFROM`me_arctype`tpLEFTJOIN`me_channeltype`chonch.id=tp.channeltypeWHEREtp.id='$totype'");$idtype="id";if(!is_array($typeInfos)){ShowMsg('参数错误!','-1');exit();}if($typeInfos['ispart']!=0){ShowMsg('文档保存的栏目必须为最终列表栏目!','-1');exit();}if(empty($typeInfos['addtable'])){$typeInfos['maintable']='me_archives';}//增加单表模型判断if($typeInfos['issystem']==-1){$typeInfos['maintable']=$typeInfos['addtable'];$idtype="aid";}$arcids=preg_replace("#[^0-9,]#",'',preg_replace("#`#",',',$qstr));$arc='';$j=0;$okids=array();$dsql->SetQuery("SELECT{$idtype},typeidFROM`{$typeInfos['maintable']}`WHERE{$idtype}in($arcids)ANDchannel='{$typeInfos['channeltype']}'");$dsql->Execute();while($row=$dsql->GetArray()){if($row['typeid']!=$totype){$dsql->ExecuteNoneQuery("insertintome_arctiny(typeid,typeid2,arcrank,channel,senddate,sortrank,mid)selecttypeid,typeid2,arcrank,channel,senddate,sortrank,midfromme_arctinywhereid='{$row[$idtype]}'");$xid=$dsql->GetLastID();$dsql->ExecuteNoneQuery("insertinto`{$typeInfos['maintable']}`(id,typeid,typeid2,sortrank,flag,ismake,channel,arcrank,click,money,title,shorttitle,color,writer,source,litpic,pubdate,senddate,mid,keywords,lastpost,scores,goodpost,badpost,voteid,notpost,description,filename,dutyadmin,tackid,mtype,weight)selectcasewhenid>'0'then'$xid'else''end,casewhentypeid>'0'then'$totype'else''end,typeid2,sortrank,flag,ismake,channel,arcrank,click,money,title,shorttitle,color,writer,source,litpic,pubdate,senddate,mid,keywords,lastpost,scores,goodpost,badpost,voteid,notpost,description,filename,dutyadmin,tackid,mtype,weightfrom`{$typeInfos['maintable']}`WHEREid='{$row[$idtype]}'");$dsql->ExecuteNoneQuery("insertinto`{$typeInfos['addtable']}`(aid,typeid,body,redirecturl,templet,userip,bigpic)selectcasewhenaid>'0'then'$xid'else''end,$totype,body,redirecturl,templet,userip,bigpicfrom`{$typeInfos['addtable']}`WHEREaid='{$row[$idtype]}'");$okids[]=$row[$idtype];$j++;}}//更新HTMLforeach($okidsas$aid){$arc=newArchives($aid);$arc->MakeHtml();}ShowMsg("成功复制$j个文档!",$ENV_GOBACK_URL);exit();}}注意最后一个步骤的me_要换成自己的后缀转自:http://www.zgguan.com/zsfx/php/574.html

2015-5-19 2666 0
2014-5-1 2973 0
源码

<!--频道分类具体内容开始--><divclass="channel_sort">{dede:channelartlistcacheid='channelsonlist'}<h3><ahref="{dede:fieldname='typeurl'/}">{dede:fieldname='typename'/}</a></h3><ul>{dede:channeltype='son'row='10'noself='yes'}<li><ahref='[field:typeurl/]'[field:rel/]><span>[field:typename/]</span></a></li>{/dede:channel}</ul>{/dede:channelartlist}</div>【Channel标记】功能说明:用于获取栏目列表适用范围:封面模板、列表模板、文档模板(1)基本语法{dede:channelrow=''type=''}自定义样式模板(InnerText){/dede:channel}(2)属性[1]row='数字'表示获取记录的条数(通用在某级栏目太多的时候使用,默认是8)[2]type=top,sun/son,selftype='top'表示顶级栏目type='son'或'sun'表示下级栏目type='self'表示同级栏目其中后两个属性必须在列表模板中使用。==============================================dede:channel和dede:channelartlist这个怎么嵌套使用呀dede二级栏目调用{dede:channelartlistrow=6}<ahref='{dede:fieldname='typeurl'/}'>{dede:fieldname='typename'/}</a>一级栏目{dede:channeltype='son'row='10'currentstyle="<liclass='hover'><ahref='~typelink~'~rel~><span>~typename~</span></a><>"}<ahref='[field:typeurl/]'[field:rel/]>[field:typename/]</a>二级栏目{/dede:channel}{/dede:channelartlist}==============================================================在dede众多的标签中,可以嵌套的标签唯一只有channelArtlist了。虽然很多功能是想用嵌套来实现,dede不支持其他标签嵌套功能,但也是可以用别的方法可以实现的。。。了解更多的可以查看下面相关的文章嵌套一:<ul>{dede:channelArtlisttypeid='1'}<li>{dede:type}[<ahref="[field:typelink/]"><b>[field:typename/]</b></a>]{/dede:type}{dede:channeltype='son'}<ahref='[field:typelink/]'>[field:typename/]</a>{/dede:channel}</li>{/dede:channelArtlist}</ul>嵌套二:{dede:channelArtlisttypeid='0'}<divclass="AList">{dede:type}<h3><ahref="[field:typelink/]">>>[field:typename/]</a></h3>{/dede:type}<ul>{dede:arclistrow="8"titlelen='100'}<li><span>[field:pubdatefunction="MyDate('Y/m/d',@me)"/]</span><ahref="[field:arcurl/]"title="[field:titlefunction='html2text(@me)'/]">[field:titlefunction='(strlen("@me")>40?cn_substr("@me",40):"@me")'/]</a></li>{/dede:arclist}</ul></div>{/dede:channelArtlist}转自:http://dedepro.iteye.com/blog/1711557嵌套二已亲测成功。

源码

dedecms的arclist标签下调用自定义字段{dede:arclistpagesize='12'typeid='10'channelid='2'addfields='wuxing,shuzi,ptitle,palt,tlink'}<dd><ahref="http://[field:tlink/]"><imgclass="img"src="[field:litpic/]"alt="[field:palt/]"title="[field:ptitle/]"/></a></dd><ul><li><ahref="http://[field:tlink/]"title="[field:ptitle/]">[field:title/]</a></li><li><imgsrc="/image/sc.jpg"alt=""title=""></li><li>[field:description/]</li><li><spanclass="red">[field:wuxing/]</span><br><li><spanclass="red">[field:shuzi/]</span></li><p><ahref="http://[field:tlink/]"target="_blank"><imgsrc="/image/xq.gif"alt="查看详情"title="查看详情"></a></p></ul>{/dede:arclist}注:要获取附加表内容,必须符合两个条件1、指定channelid属性2、指定要获得的字段addfields='字段1,字段'如:{dede:arclistaddfields='filetype,language,softtype'row='8'channelid='3'}[field:textlink/]-[field:softtype/]<br/>{/dede:arclist}dedecms高级搜索调用缩略图{dede:fieldname='litpic'/}dedecms去后台验证码DATA文件夹里的\safe\inc_safe_config.php$safe_gdopen=’1,2,3,4,5,6′;这句代码“6”删除了,就可以了。dedecms密码重置见附件:radminpass.rardede的php当前时间加/减天当前时间:{dede:phprunphp='yes'}$ntime=time();@me=MyDate('Y-m-d',$ntime);{/dede:php}当前时间减1天:{dede:phprunphp='yes'}$ntime=time();@me=MyDate('Y-m-d',strtotime('-1day'),$ntime);{/dede:php}详情查看php的strtotime()函数。dede自定义表单提交后直接弹出对话框plus/diy.php查找$goto='/';$bkmsg='发布成功,请等待管理员处理...';修改为:echo'<script>alert("发布成功,请等待管理员处理...");history.go(-1);</script>';dede后台自定义表单一页显示50条后台/diy_list.php查找$datalist->pageSize=10;修改为:$datalist->pageSize=50;dede后台自定义表单全选功能后台/templets/diy_list.htm查找<b>内容列表</b>在后添加:<script>functionSelectAll(){varcheckboxs=document.getElementsByName("id[]");for(vari=0;i<checkboxs.length;i++){vare=checkboxs[i];e.checked=!e.checked;}}</script><ahref="#"onclick="SelectAll()">全选/反选</a>dede标题不受字数限制[field:fulltitle/]其中titlelen=’24′控制的是标题[field:title/]的字数为12个汉字,[field:fulltitle/]控制鼠标划过时提示完整标题名称。这样,无论是搜索引擎还是目标访客都相当友好了dede按权重排序{dede:arclistrow='10'titlelen='34'isweight="Y"orderby='weight'typeid='3'idlist=''}我们在使用orderby='weight'时需要在前面加上isweight="Y"来开启权重的使用参考:http://jingyan.baidu.com/article/93f9803f0efb98e0e46f552c.html{dede:list}增加按权重排序标签1、打开\include\目录中的arc.listview.class.php文件,搜索“排序方式”,然后在elseif($orderby=="lastpost"){$ordersql="orderbyarc.lastpost$orderWay";}elseif($orderby=="weight"){$ordersql="orderbyarc.weightasc";}else{$ordersql="orderbyarc.sortrank$orderWay";}这段代码中间添加以上红色代码。4、向下找到if(ereg('hot|click|lastpost',$orderby))或者是if(preg_match('/hot|click|lastpost/',$orderby))修改成if(ereg('hot|click|lastpost|weight',$orderby))或者是if(preg_match('/hot|click|lastpost|weight/',$orderby)),保存文件。这个时候在列表页里就可以使用{dede:listpagesize='5'orderby='weight'}进行排序了。dede导航栏顶级栏目和二级栏目同时调用{dede:channelartlisttypeid='top'}<ahref="{dede:fieldname='typeurl'/}">{dede:fieldname='typename'/}</a>{dede:channeltype='son'noself='yes'}<div><ahref="[field:typelink/]">[field:typename/]</a></div>{/dede:channel}{/dede:channelartlist}自定义模型,在arclist中调用自定义字段只需要在arclist中增加两个属性:1.channelid也就是模型的id,必须2.addfields需要调用的字段名,必须例如:{dede:arclistchannelid=18addfields='stname'}stname:[field:stname/]{/dede:arclist}注意,需要在模型设置中,对应的字段开启“允许在列表底层中调用,默认只在文档模板中调用”的选项dede数字递增,+后面加数字[field:globalname=autoindexrunphp="yes"]@me=@me+1;[/field:global]清空DEDE自定义表单所有数据TRUNCATETABLE`dede_diyform1;直接调用上一篇地址和下一篇地址的代码如下上一篇地址{dede:prenextget='pro'runphp="yes"}preg_match_all('/<a.*?(?:|\\t|\\r|\\n)?href=[\'"]?(.+?)[\'"]?(?:(?:|\\t|\\r|\\n)+.*?)?>(.+?)<\/a.*?>/sim',@me,$strResult,PREG_PATTERN_ORDER);@me=$strResult[1][0];{/dede:prenext}下一篇地址{dede:prenextget='next'runphp="yes"}preg_match_all('/<a.*?(?:|\\t|\\r|\\n)?href=[\'"]?(.+?)[\'"]?(?:(?:|\\t|\\r|\\n)+.*?)?>(.+?)<\/a.*?>/sim',@me,$strResult,PREG_PATTERN_ORDER);@me=$strResult[1][0];{/dede:prenext}dede调用二三级菜单{dede:channelartlisttypeid='11'}<liclass="por_content_c"><ahref="{dede:fieldname='typeurl'/}"title="{dede:fieldname='typename'/}">{dede:fieldname='typename'/}</a></li>{dede:sqlsql='Select*from#@__arctypewherereid=~id~ORDERBYidlimit0,200'}<liclass="por_content_c1"><ahref="[field:typedir/]/">[field:typename/]</a></li>{/dede:sql}{/dede:channelartlist}id为需要调用二三级菜单的一级菜单ID如果单独指定调用一个或者多个栏目的话{dede:channelartlisttypeid='1,2'}在里面指定你需要调用的id即可,如:{dede:channelartlisttypeid='1'}<liclass="por_content_c2"><ahref="{dede:fieldname='typeurl'/}"title="{dede:fieldname='typename'/}">{dede:fieldname='typename'/}</a></li>{/dede:channelartlist}也可以用sql直接调用单独栏目的子栏目附带一些css容易忘的:鼠标移动变小手:style="cursor:pointer;