织梦幻灯片由标题+标题背景+分页组成,很多朋友的织梦网站幻灯片想要看起来漂亮,例如织梦官网幻灯片:
然后我们查看一下它的源码:
<!-- size: 682px * 240px --> <scriptlanguage='javascript'> linkarr = new Array(); picarr = new Array(); textarr = new Array(); var swf_width=682; var swf_height=240; var files = ""; var links = ""; var texts = ""; //这里设置调用标记 linkarr[1] = "/plus/view.php?aid=1099"; picarr[1] = "http://www.dedecms.com/products/education/edupic.gif"; linkarr[2] = "/plus/view.php?aid=1091"; picarr[2] = "http://www.dedecms.com/img/adimg/dedev56.jpg"; linkarr[3] = "/blog/2009/0929/1026.html"; picarr[3] = "/uploads/allimg/090929/1-0Z9291622310-L.jpg"; linkarr[4] = "/news/me/2009/0929/1018.html"; picarr[4] = "/uploads/allimg/090929/1-0Z929152P00-L.jpg";
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="/templets/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_config=0xffffff|2|0x8CA2AD|60|0xffffff|0xff9900|0x000033|2|3|1|_blank">'); document.write('<embed src="/templets/images/bcastr3.swf" wmode="opaque" FlashVars="bcastr_file='+files+'&bcastr_link='+links+'&bcastr_title='+texts+'& 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> |
这段代码看起来复杂,其实很简单,所以下面详细解读一下织梦幻灯片的做法:
织梦官方幻灯片代码解读:
<script language='javascript'> linkarr = new Array(); picarr = new Array(); textarr = new Array(); //幻灯片大小,这里我们也可以修改幻灯片得长度 和 宽度 var swf_width=280; var swf_height=192; //下面可以修改文字颜色|文字位置|文字背景颜色|文字背景透明度|按键文字颜色|按键默认颜色|按键当前颜色|自动播放时间|图片过渡效果|是否显示按钮|打开方式 var configtg='0xffffff|0|0x3FA61F|5|0xffffff|0xC5DDBC|0x000033|2|3|1|_blank'; var files = ""; var links = ""; var texts = ""; //这里设置调用标记row代表调用的图片数量 {dede:arclist flag='f' row='5'} 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+'">');
</script> |
删除文字需要把
var configtg='0xffffff|0|0x3FA61F|5|0xffffff|0xC5DDBC|0x000033|2|3|1|_blank'; |
修改成
var configtg='0xffffff||0x3FA61F|5|0xffffff|0xC5DDBC|0x000033|2|3|1|_blank'; |
还要把 DEDECMS模板
textarr[[field:global.autoindex/]] = "[field:title function='html2text(@me)'/]"; |
跟
for(i=1;i<textarr.length;i++){ if(texts=="") texts = textarr[i]; else texts += "|"+textarr[i]; } |
删除即可。
最后,再在织梦网站后台核心里面找到栏目管理,进行添加有幻灯属性的带图片的文档即可!
然后保存,一键更新网站即可。就这样一个简单的动作就让你的网站显得更漂亮,更美观了。