源码

一、修改文件:\include\taglib目录下的channel.lib.php,请将以下代码全部复制替换上述文件<?phpfunctionlib_channel(&$ctag,&$refObj){global$_sys_globals,$envs,$dsql;$attlist="typeid|0,reid|0,row|100,col|1,type|son,currentstyle|";FillAttsDefault($ctag->CAttribute->Items,$attlist);extract($ctag->CAttribute->Items,EXTR_SKIP);$innertext=$ctag->GetInnerText();$cacheid=trim($cacheid);if($cacheid!=''){$likeType=GetCacheBlock($cacheid);if($likeType!='')return$likeType;}$reid=0;$topid=0;if(empty($typeid)&&$envs['typeid']!=0){$typeid=$envs['typeid'];$reid=$envs['reid'];}else{$reid=0;}if($type==''||$type=='sun')$type="son";if($innertext=='')$innertext=GetSysTemplets("channel_list.htm");if($reid==0&&$typeid>0){$dbrow=$dsql->GetOne("SelectreidFromdede_arctypewhereid='$typeid'");if(is_array($dbrow))$reid=$dbrow['reid'];}$likeType='';if($type=='top'){$sql="Selectid,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath,descriptionFromdede_arctypewherereid=0Andishidden<>1orderbysortrankasclimit0,$row";}elseif($type=="son"){//if($_sys_globals['typeid']>0)$typeid=$_sys_globals['typeid'];if($typeid==0){return'';}$sql="Selectid,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath,descriptionFromdede_arctypewherereid='$typeid'Andishidden<>1orderbysortrankasclimit0,$row";}elseif($type=="self"){if($reid==0){return'';}$sql="Selectid,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath,descriptionFrom`dede_arctype`wherereid='$reid'Andishidden<>1orderbysortrankasclimit0,$row";}//Andid<>'$typeid'$needRel=false;$dtp2=newDedeTagParse();$dtp2->SetNameSpace("field","[","]");$dtp2->LoadSource($innertext);$dsql2=clone$dsql;$dsql->SetQuery($sql);$dsql->Execute();$line=$row;//检查是否有子栏目,并返回rel提示(用于二级菜单)if(ereg(':rel',$innertext))$needRel=true;if(empty($sql))return'';$dsql->SetQuery($sql);$dsql->Execute();$totalRow=$dsql->GetTotalRow();$GLOBALS['autoindex']=0;for($i=0;$i<$line;$i++){if($col>1)$likeType.="<dl>\r\n";for($j=0;$j<$col;$j++){if($col>1)$likeType.="<dd>\r\n";if($row=$dsql->GetArray()){$row['sonids']=$row['rel']='';if($needRel){$row['sonids']=GetSonIds($row['id'],0,false);if($row['sonids']=='')$row['rel']='';else$row['rel']="rel='dropmenu{$row['id']}'";}//处理同级栏目中,当前栏目的样式if(($row['id']==$typeid||($topid==$row['id']&&$type=='top'))&&$currentstyle!=''){if($currentstyle!=''){$linkOkstr=$currentstyle;$row['typelink']=GetOneTypeUrlA($row);$linkOkstr=str_replace("~rel~",$row['rel'],$linkOkstr);$linkOkstr=str_replace("~id~",$row['id'],$linkOkstr);$linkOkstr=str_replace("~typelink~",$row['typelink'],$linkOkstr);$linkOkstr=str_replace("~typename~",$row['typename'],$linkOkstr);$likeType.=$linkOkstr;}}else{$row['typelink']=$row['typeurl']=GetOneTypeUrlA($row);if(is_array($dtp2->CTags)){foreach($dtp2->CTagsas$tagid=>$ctag){if(isset($row[$ctag->GetName()])){$dtp2->Assign($tagid,$row[$ctag->GetName()]);}elseif(preg_match('/^sonchannel[0-9]*$/',$ctag->GetName())){$dtp2->Assign($tagid,lib_channel_son($ctag,$row['id'],$dsql2));}}}$likeType.=$dtp2->GetResult();}}if($col>1)$likeType.="</dd>\r\n";$GLOBALS['autoindex']++;}//LoopColif($col>1){$i+=$col-1;$likeType.="</dl>\r\n";}}//Loopfor$ireset($dsql2);$dsql->FreeResult();return$likeType;}functionlib_channel_son($ctag,$typeid=0,$dsql2){$attlist="row|100,col|1,currentstyle|";FillAttsDefault($ctag->CAttribute->Items,$attlist);extract($ctag->CAttribute->Items,EXTR_SKIP);$innertext=$ctag->GetInnerText();$dsql3=clone$dsql2;$likeType='';//if($_sys_globals['typeid']>0)$typeid=$_sys_globals['typeid'];if($typeid==0){return'';}$sql="Selectid,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath,descriptionFromdede_arctypewherereid='$typeid'Andishidden<>1orderbysortrankasclimit0,$row";//Andid<>'$typeid'$dtp2=newDedeTagParse();$dtp2->SetNameSpace("field","[","]");$dtp2->LoadSource($innertext);$dsql2->SetQuery($sql);$dsql2->Execute();$line=$row;for($i=0;$i<$line;$i++){if($col>1)$likeType.="<dl>\r\n";for($j=0;$j<$col;$j++){if($col>1)$likeType.="<dd>\r\n";if($row=$dsql2->GetArray()){$row['typelink']=$row['typeurl']=GetOneTypeUrlA($row);if(is_array($dtp2->CTags)){foreach($dtp2->CTagsas$tagid=>$ctag){if(isset($row[$ctag->GetName()])){$dtp2->Assign($tagid,$row[$ctag->GetName()]);}elseif(preg_match('/^sonchannel[0-9]*$/',$ctag->GetName())){$dtp2->Assign($tagid,lib_channel_son($ctag,$row['id'],$dsql3));}}}$likeType.=$dtp2->GetResult();}if($col>1)$likeType.="</dd>\r\n";}//LoopColif($col>1){$i+=$col-1;$likeType.="</dl>\r\n";}}//Loopfor$ireset($dsql3);$dsql2->FreeResult();return$likeType;}?>二、在模板调用实例:{dede:channeltype='son'typeid='7'}[field:typename/]<ul>[field:sonchannel0]<li><ahref="[field:typename/]http://www.skyey.com.cn/[field:typelink/]">---[field:typename/]</a></li>[field:sonchannel2]<li><ahref="===[field:typename/]http://www.skyey.com.cn/[field:typelink/]">===[field:typename/]</a></li>[/field:sonchannel3][/field:sonchannel2][/field:sonchannel1][/field:sonchannel0]</ul>{/dede:channel}模板调用[field:sonchannel0][/field:sonchannel0]这个是用来取子栏目用得(使用[sonchannel+数字]作为标签名是为了防止嵌套的时候无法正确解析标签)这个的作用就是当你的栏目有很多子栏目无限分级的时候方便你取子栏目的转自:http://www.cnblogs.com/seaven/archive/2012/12/02/2798000.html

源码

很多网友在论坛发帖询问如何增加自定义属性,论坛中也有网友发帖解惑,采用的是服务器数据库后台管理的方式,这种方法对于大部分不熟悉操作的朋友来说,根本看不明白。呵呵~下面我将帮助文档中提及到的一种很简单的方法,用文字加图示的方式展现给大家,希望对这些朋友有所帮助。第一步:在织梦后台左栏点击“系统”;第二步:选择“系统”菜单下的“SQL命令行工具”;第三步:输入如下代码;insertinto`dede_arcatt`(sortid,att,attname)values(9,'d','评论');altertable`dede_archives`modify`flag`set('h','c','p','f','s','j','a','b','d')defaultNULL;第四步:点击“确定”。需要说明的是:代码第1行:values(9,'d','评论')是根据我们需要自行定义的,其中9是sortid的值,是不可重复的,也就是每添加一个自定义属性,sortid的值就应该递增到10,11,12...,以此类推!d是alt的值,是自定义属性的标记,与已存在的标记符号不能重复,“评论”是中文名称,是方便人们直观地勒戒自定义属性的含义的,可以根据需要改为“网络”、“新闻头条”等。代码第2行:set('c','h','p','f','s','j','a','b','d'),括号中的字母对应已存在的标记符号和您需要添加的标记符号,并按顺序录入,不得改变先后顺序。例如,d排序第9位,则对应第一行代码中添加的自定义属性““评论d”。

2013-1-25 4305 0
源码

多组投票模块基于官方投票模块开发仅学校交流使用请勿商业用途本人不承担任何责任有好的建议或者bug请发邮件!安装前先备份投票模块数据。安装本模块会清空原来投票的所有表默认后台文件夹dede关闭系统配置里面的模块缓存选项。缓存更新一遍打开投票模块可查看。强烈建议使用以下单页模板生成../templets/default/singlepage.htm测试页面可单页生成需编译选项勾上原来投票标记dede:vote功能不变在此基础上添加{dede:votelistvotelist='testetest'}根据tag名调用组投票{/dede:votelist}功能添加添加用户联系方式统计新加表vote_tel保存用户联系方式用户联系可后台管理ajax异步提交保存联系方式完成相关验证及中文乱码问题前台投票投票结果分组后台投票添加分组显示括号内为调用tag投票分类管理界面经测试,发现该插件为gbk插件,utf不可以用还经过测试,该插件的封装后的后台路径不对,需要把0576admin里面的文件覆盖到自己的后台文件中(注意备份)。然后投票页面需要有以下js才能正常,注意路径:<scriptlanguage="javascript"src="/include/js/jquery/jquery-1.7.1.min.js"></script><scriptlanguage='javascript'type='text/javascript'>functionvotesubmit(){varmid=0;varfocusid='';varnum=document.getElementById("countshiti").value;for(i=1;i<=num;i++){varvotemsg="votemsg_"+i;varvismore=(document.getElementById("ismore_"+i).value==0?'':'[]');varvoteid="vote_"+document.getElementById("voteid_"+i).value+vismore;varvoteinput=document.getElementById(voteid).value;vardaanvalue=document.getElementsByName(voteid);vark=0for(h=0;h<daanvalue.length;h++){if(daanvalue[h].checked==true){k++;}}if(k==0){mid++;$('#'+votemsg).html("该项不能为空");}else{$('#'+votemsg).html("");}if(mid==1){focusid=voteid;}}if(mid==0){document.getElementById("votemid").value=0;document.getElementById("votelist").submit();}else{alert('某项为空,请检查!');$("#"+focusid).focus();}}functionontouch(){varmid=0;varnum=document.getElementById("countshiti").value;for(i=1;i<=num;i++){varvotemsg="votemsg_"+i;varvismore=(document.getElementById("ismore_"+i).value==0?'':'[]');varvoteid="vote_"+document.getElementById("voteid_"+i).value+vismore;varvoteinput=document.getElementById(voteid).value;vardaanvalue=document.getElementsByName(voteid);vark=0;for(h=0;h<daanvalue.length;h++){if(daanvalue[h].checked==true){k++;}}if(k==0){mid++;}}varres=(num-mid)*100/num;varloadprogressleft=58+(num-mid)*140/num;varfen=formatFloat(res,2);$('#loadcss').css({width:fen+'%'});$('#loadprogress').html(fen+'%');$('.tips').css({left:loadprogressleft+'px'});}functionformatFloat(src,pos){returnMath.round(src*Math.pow(10,pos))/Math.pow(10,pos);}functionopenWebBox(){varbg=window.document.getElementById("bg");varwebbox=window.document.getElementById("webbox");bg.style.visibility="visible";webbox.style.display="block";}</script>最后,根据自己的需求修改/templets/plus/votelist.htm以及:plus/votelist.php多组投票dede的插件目前就找到这一个,所以必须要用到的时候,经过一番修改也还不错。

2013-1-25 10366 0