首先看一下调用标签,上一篇是{dede:prenextget=’pre’/}下一篇是{dede:prenextget=’next’/}一、去除上一篇和下一篇的文字,只显示标题。1.修改include/arc.archives.class.php文件,查找”上一篇”关键词,将上一篇去除及可,或者大家也可以改成其它需要的文字,如图所示:织梦修改上一篇下一篇二、限制上一篇和下一篇的标题长度。1.同样是在include/arc.archives.class.php文件里面,加入如下红色代码,设置默认24个字符,中文也就是12个文字。//获取上一篇,下一篇链接functionGetPreNext($gtype=”,$titlelen=28)2.再往下找,插入红色部分!即是用截取后的长度赋予$preRow['title2'],那么原始没截取的就是$preRow['title']$preRow['namerule'],$preRow['typedir'],$preRow['money'],$preRow['filename'],$preRow['moresite'],$preRow['siteurl'],$preRow['sitepath']);$preRow['title2']=cn_substr($preRow['title'],$titlelen);$this->PreNext['pre']=”上一篇:<ahref=’$mlink’3.然后在前台模板就可以这样调用了。<listyle=”float:left;”title=”上一篇”>{dede:prenextget=’pre’titlelen=’18′/}</li><listyle=”float:right;”title=”下一篇”>{dede:prenextget=’next’titlelen=’18′/}</li>来自:http://jingyan.baidu.com/article/219f4bf7dddb88de442d380c.html
我们经常使用js跳转来判断手机设备然后进行跳转,不过跳转终究是跳转,而如果使用程序来判断设备进行输出代码,不进行URL跳转岂不是更好,以下是php判断是否为手机,如果为手机就输出指定手机页面,如果不是就输出指定pc页面<?php//判断是否是手机functionisMobile(){$useragent=isset($_SERVER['HTTP_USER_AGENT'])?$_SERVER['HTTP_USER_AGENT']:'';$useragent_commentsblock=preg_match('|\(.*?\)|',$useragent,$matches)>0?$matches[0]:'';functionCheckSubstrs($substrs,$text){foreach($substrsas$substr)if(false!==strpos($text,$substr)){returntrue;}returnfalse;}$mobile_os_list=array('GoogleWirelessTranscoder','WindowsCE','WindowsCE','Symbian','Android','armv6l','armv5','Mobile','CentOS','mowser','AvantGo','OperaMobi','J2ME/MIDP','Smartphone','Go.Web','Palm','iPAQ');$mobile_token_list=array('Profile/MIDP','Configuration/CLDC-','160×160','176×220','240×240','240×320','320×240','UP.Browser','UP.Link','SymbianOS','PalmOS','PocketPC','SonyEricsson','Nokia','BlackBerry','Vodafone','BenQ','Novarra-Vision','Iris','NetFront','HTC_','Xda_','SAMSUNG-SGH','Wapaka','DoCoMo','iPhone','iPod');$found_mobile=CheckSubstrs($mobile_os_list,$useragent_commentsblock)||CheckSubstrs($mobile_token_list,$useragent);if($found_mobile){returntrue;}else{returnfalse;}}if(isMobile()){include("wap.html");exit();}else{include("index.html");}?>
虽然rss是一个很古老的东西,但是对于搜索引擎来说,应该算法还是特别喜欢这种有rss的网站的,所以做优化弄一个也何尝不可。dede自带的有rss,但是样式和路径总觉得不好,样式就不说了,改很容易,路径的话,需要修改几个dede的文件来达到自定义dede的rss路径的作用,修改文件如下:dede/makehtml_map.phpinclude/arc.rssview.class.phpinclude/sitemap.class.php直接找到以上文件,搜索data进行对应的修改即可。顺便补充下,样式模板位置在:\templets\plus\rssmap.htm\templets\plus\sitemap.htm
为了减少服务器连接数。或者是为了确保JS执行时,所依赖CSS文件已经下载完成。你是否想过要把CSS和JS写到一个文件里呢?今天学了一招,正好解决这个问题![原作者的BLOG:http://blogs.msdn.com/shivap/archive/2007/05/01/combine-css-with-js-and-make-it-into-a-single-download.aspx]这其实是利用了浏览器特性的一种HACK手法!作者说在IE和FF下能正常使用。我用opera9.02测试过了,可以正常运行。关键点:CSS和JS解析器在处理注释的区别1.CSS解析器在碰到“<!--”的时候会直接抛弃2.JS解析器在碰到“<!--”的时候,会把他当作"//"处理。也就是说把他当做行注释处理!看看下面这个代码片段:1<!--/*2functiontest(){alert("虽然使用性有待商榷。\n但想法值得称赞!");}3<!--*/4<!--body{background-color:#f00;}CSS解析时,它等价于下面这段代码1/*2functiontest(){alert("虽然使用性有待商榷。\n但想法值得称赞!");}3*/4body{background-color:#f00;}而JS解析时,他却等价于如下代码1///*----行注释2functiontest(){alert("虽然使用性有待商榷。\n但想法值得称赞!");}3//*/----行注释4//body{background-color:#f00;}----行注释问题是不是解决了呢?将这段代码,保存成1.jcs。[或其他任意文件名,引用的时候做对应修改就行了]然后,将下面代码保存成任意文件。和他放在同一目录下即可!1<linktype="text/css"rel="stylesheet"href="1.jcs"/>2<scripttype="text/javascript"language="javascript"src="1.jcs"></script>3<inputtype="button"value="点我一下,看包含的函数是否可以执行"onclick="test()"/>link和script标签虽然两次链接该文件。但是由于缓存的缘故,只会发一次请求!当然,代价是增加了约等于“4*css行数”的冗于代码。正常情况下,这个冗于在1K以内!来源:http://www.cnblogs.com/devweb/archive/2009/10/09/1579535.html
其实flash遮挡div方法有很多,但大多数都没有写是为什么遮挡了,下面是我总结的原因:可能不全,不过我现在还没有发现在别的问题。原因也就是没有给flash添加透明效果这个属性。我们在<object></object>标签里面添加如下代码问题应该就解决了,并非是给z-index设置值的问题。12345<objectclassid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0"width="590"height="105"><paramname="movie"value="http://gg.blueidea.com/2005/www/533-104.swf"/><paramname="quality"value="high"/><paramname="wmode"value="transparent"/><embedsrc="你的flash.swf"width="590"height="105"quality="high"1pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash"type="application/x-shockwave-flash"12wmode="transparent"></embed></object>有两点要注意:1、<paramname="wmode"value="transparent"/>2、<embedwmode="transparent">重点在这里,在<embed>中加入wmode="transparent"属性,FF中层的问题就可以解决了。3、type="application/x-shockwave-flash"以上三行代码一定要加上,flash才不会挡住,DIV。来源:http://www.cnblogs.com/sjrhero/articles/1850524.html附加:如果是div与div直接有遮挡可以尝试下面的方法:先在<div>的父辈元素设定position:relative;在同级的<div>和自身都设置position:relative;在目标<div>设置z-index:99
当我们转移网站,或者更改数据库,又或者升级的时候,dede经常会出现下面请看1.加不了文章,发文章提示“无法获得主键,因此无法进行后续操作!”2.修改不了基本参数3.基本参数显示空白,但可以修改参数当这种问题同时出现或者单个问题出现的话,是非常头疼的问题,因为以上几个问题,百度和谷歌都没有很好的回答,大部分解决方法几乎是无效的。所以研究了下,如果出现以上问题,其实原因如下:1.加不了文章,修改不了基本参数——数据库转移过程中的改名有关,重新导入数据库,用帝国备份王之类的方法或sql等2.基本参数显示空白,但可以修改参数——php版本问题,php5.4运行低版本dede导致的,高版本dede不受影响,解决方法是换低版本的php,或者换高版本的dede,或者修改低版本的dede代码,修改代码过程百度到处都是。由于没有亲测,所以这里就不多说。遇到类似问题,无非检查以下问题:1.php版本对不对2.mysql数据对不对3.网站文件权限对不对4.数据库文件权限对不对
<scriptsrc="http://siteapp.baidu.com/static/webappservice/uaredirect.js"type="text/javascript"></script><scripttype="text/javascript">uaredirect("http://www.hack001.com/wap/");</script>这段代码相信很多人都会用,就是判断是不是移动端,如果是就跳转到对应的移动设备页面,但是今天发现百度的siteapp.baidu.com,尽然打不开了,这将导致很多使用该代码的站点都会受影响,如果站点正在进行推广,估计移动端流量将全部废掉了,损失相当的大,所以有时候百度也是靠不住的,重要js还是要放到本地的靠谱,下面是uaredirect.js的文件,快放到自己服务器上吧。
给织梦添加复制文档的功能步骤如下:一、打开templets下的content_list.htm找到这一行:<ahref="javascript:;"onClick="moveArc(event,this,<?phpecho(empty($channelid)?0:$channelid);?>)"class="coolbg"> 移动 </a>在这一行的下方添加:<ahref="javascript:;"onClick="copyArc(event,this,<?phpecho(empty($channelid)?0:$channelid);?>);"class="coolbg"> 复制 </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'> 目标栏目:</td><tdclass='bline'><?phpecho$typeOptions;?></td></tr><trheight='32'><tdwidth="80"class='bline'> 文档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"/> <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