当前位置: 代码迷 >> Web前端 >> 织梦(dedecms)仿站课程第二十讲―dede幻灯片制作
  详细解决方案

织梦(dedecms)仿站课程第二十讲―dede幻灯片制作

热度:629   发布时间:2013-02-24 17:58:56.0
织梦(dedecms)仿站教程第二十讲―dede幻灯片制作
这一讲说说封面页的右侧,右侧最上面是幻灯片代码,在讲首页制作时,讲过幻灯片代码,我们这里简要说说。
我们直接将拳击在线封面里的幻灯片代码:
  1. <SCRIPT type=text/javascript> 
  2. <!--  
  3.  var interval_time=3;  
  4.  var focus_width=288;  
  5.  var focus_height=220;  
  6.  var text_height=19;  
  7.  var text_align="center";  
  8.  var swf_height = focus_height+text_height;  
  9.  var swfpath="/e/data/images/pixviewer.swf";  
  10.  var swfpatha="/e/data/images/pixviewer.swf";  
  11.  var pics="%2Fd%2Ffile%2Fnews%2F1%2F732488265adfe6d9153f489f7550e2dc.jpg%7C%2Fd%2Ffile%2Fnews%2F1%2Fe02812004247d409b9ed1716b8169f5e.jpg%7C%2Fd%2Ffile%2Fnews%2F1%2Fsmall0a72185ad918b79b8177baff67a7d8f51309318211.jpg";  
  12.  var links="%2Fnews%2F1%2F6095.html%7C%2Fnews%2F1%2F6093.html%7C%2Fnews%2F1%2F6004.html";  
  13.  var texts="可汗5回合KO朱达获得胜利(附视频)|小克里琴科点数战胜海耶 统一四大拳击组织(|梅威瑟VS奥提兹纽约召开新闻发布会";  
  14.  document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="'+ focus_width +'" height="'+ swf_height +'">');  
  15.  document.write('<param name="movie" value="'+swfpath+'"><param name="quality" value="high"><param name="bgcolor" value="#ffffff">');  
  16.  document.write('<param name="menu" value="false"><param name=wmode value="opaque">');  
  17.  document.write('<param name="FlashVars" value="pics='+pics+'&links='+links+'&texts='+texts+'&borderwidth='+focus_width+'&borderheight='+focus_height+'&textheight='+text_height+'&text_align='+text_align+'&interval_time='+interval_time+'">');  
  18.  document.write('<embed src="'+swfpath+'" wmode="opaque" FlashVars="pics='+pics+'&links='+links+'&texts='+texts+'&borderwidth='+focus_width+'&borderheight='+focus_height+'&textheight='+text_height+'&text_align='+text_align+'&interval_time='+interval_time+'" menu="false" bgcolor="#ffffff" quality="high" width="'+ focus_width +'" height="'+ swf_height +'" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');  
  19.  document.write('</object>');  
  20. //--> 
  21. </SCRIPT> 
替换成织梦封面里的幻灯片代码:
  1.    <script language='javascript'> 
  2. linkarr = new Array();  
  3. picarr = new Array();  
  4. textarr = new Array();  
  5. var swf_width=280;  
  6. var swf_height=192;  
  7. var files = "";  
  8. var links = "";  
  9. var texts = "";  
  10. //这里设置调用标记  
  11. {dede:arclistflag='f' row='5'}  
  12. linkarr[[field:global.autoindex/]] = "[field:arcurl/]";  
  13. picarr[[field:global.autoindex/]]  = "[field:litpic/]";  
  14. textarr[[field:global.autoindex/]] = "[field:title function='html2text(@me)'/]";  
  15. {/dede:arclist}  
  16. for(i=1;i<picarr.length;i++){  
  17.   if(files=="") files = picarr[i];  
  18.   else files += "|"+picarr[i];  
  19. }  
  20. for(i=1;i<linkarr.length;i++){  
  21.   if(links=="") links = linkarr[i];  
  22.   else links += "|"+linkarr[i];  
  23. }  
  24. for(i=1;i<textarr.length;i++){  
  25.   if(texts=="") texts = textarr[i];  
  26.   else texts += "|"+textarr[i];  
  27. }  
  28. 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 +'">');  
  29. document.write('<param name="movie" value="{dede:global.cfg_templets_skin/}/images/bcastr3.swf"><param name="quality" value="high">');  
  30. document.write('<param name="menu" value="false"><param name=wmode value="opaque">');  
  31. document.write('<param name="FlashVars" value="bcastr_file='+files+'&bcastr_link='+links+'&bcastr_title='+texts+'">');  
  32. document.write('<embed src="{dede:global.cfg_templets_skin/}/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>');  
  33. </script> 
将将上面代码里的宽度和高度修改一下,将
var swf_width=280;  
var swf_height=192; 
修改为:
var swf_width=288;  
var swf_height=239; 
因为织梦幻灯片的文字在幻片上面,所以高度要等于原幻灯高度加文字高度,所以高度为239。
本来想将右侧放在一节里面讲完,但下面的最新新闻和热门新闻在列表页和内容页都会用到,所以我们放在一个单独的一节里讲解。看下我们这一讲的成绩吧!
  相关解决方案