ECSHOP首页轮播广告图片播放器用js播放器替换

1、首页主广告管理-》自定义,粘下以下代码:

  1. <script type="text/javascript">

  2. var glide =new function(){

  3. function $id(id){return document.getElementByIdx_x(id);};

  4. this.layerGlide=function(auto,oEventCont,oSlider,sSingleSize,second,fSpeed,point){

  5. var oSubLi = $id(oEventCont).getElementsByTagName_r('li');

  6. var interval,timeout,oslideRange;

  7. var time=1;

  8. var speed = fSpeed

  9. var sum = oSubLi.length;

  10. var a=0;

  11. var delay=second * 2000;

  12. var setValLeft=function(s){

  13. return function(){

  14. oslideRange = Math.abs(parseInt($id(oSlider).style[point]));

  15. $id(oSlider).style[point] =-Math.floor(oslideRange+(parseInt(s*sSingleSize) - oslideRange)*speed) +'px';

  16. if(oslideRange==[(sSingleSize * s)]){

  17. clearInterval(interval);

  18. a=s;

  19. }

  20. }

  21. };

  22. var setValRight=function(s){

  23. return function(){

  24. oslideRange = Math.abs(parseInt($id(oSlider).style[point]));

  25. $id(oSlider).style[point] =-Math.ceil(oslideRange+(parseInt(s*sSingleSize) - oslideRange)*speed) +'px';

  26. if(oslideRange==[(sSingleSize * s)]){

  27. clearInterval(interval);

  28. a=s;

  29. }

  30. }

  31. }

  32. function autoGlide(){

  33. for(var c=0;c<sum;c++){oSubLi[c].className='';};

  34. clearTimeout(interval);

  35. if(a==(parseInt(sum)-1)){

  36. for(var c=0;c<sum;c++){oSubLi[c].className='';};

  37. a=0;

  38. oSubLi[a].className="active";

  39. interval = setInterval(setValLeft(a),time);

  40. timeout = setTimeout(autoGlide,delay);

  41. }else{

  42. a++;

  43. oSubLi[a].className="active";

  44. interval = setInterval(setValRight(a),time);

  45. timeout = setTimeout(autoGlide,delay);

  46. }

  47. }

  48. if(auto){timeout = setTimeout(autoGlide,delay);};

  49. for(var i=0;i<sum;i++){

  50. oSubLi.onmouseover = (function(i){

  51. return function(){

  52. for(var c=0;c<sum;c++){oSubLi[c].className='';};

  53. clearTimeout(timeout);

  54. clearInterval(interval);

  55. oSubLi.className="active";

  56. if(Math.abs(parseInt($id(oSlider).style[point]))>[(sSingleSize * i)]){

  57. interval = setInterval(setValLeft(i),time);

  58. this.onmouseout=function(){if(auto){timeout = setTimeout(autoGlide,delay);};};

  59. }else if(Math.abs(parseInt($id(oSlider).style[point]))<[(sSingleSize * i)]){

  60. interval = setInterval(setValRight(i),time);

  61. this.onmouseout=function(){if(auto){timeout = setTimeout(autoGlide,delay);};};

  62. }

  63. }

  64. })(i)

  65. }

  66. }

  67. }

  68. glide.layerGlide(true,'icon_num','show_pic',534,2,0.1,'left');

  69. </script>

  70. <!-- 向右效果 -->

复制代码
 

2、index.php:
寻找$smarty->display('index.dwt', $cache_id);下面加:

  1. function get_flash_xml()

  2. {

  3. $flashdb = array();

  4. if (file_exists(ROOT_PATH . DATA_DIR . '/flash_data.xml'))

  5. {

  6. // 兼容v2.7.0及以前版本

  7. if (!preg_match_all('/item_url="([^"]+)"\slink="([^"]+)"\stext="([^"]*)"\ssort="([^"]*)"/', file_get_contents(ROOT_PATH . DATA_DIR . '/flash_data.xml'), $t, PREG_SET_ORDER))

  8. {

  9. preg_match_all('/item_url="([^"]+)"\slink="([^"]+)"\stext="([^"]*)"/', file_get_contents(ROOT_PATH . DATA_DIR . '/flash_data.xml'), $t, PREG_SET_ORDER);

  10. }

  11. if (!empty($t))

  12. {

  13. foreach ($t as $key => $val)

  14. {

  15. $val[4] = isset($val[4]) ? $val[4] : 0;

  16. $flashdb[] = array('src'=>$val[1],'url'=>$val[2],'text'=>$val[3],'sort'=>$val[4]);

  17. }

  18. }

  19. }

  20. return $flashdb;

  21. }

复制代码

3、寻找$smarty->assign('auction_list',    index_get_auction());        // 拍卖活动,下面加上:

 $smarty->assign('playerdb',         get_flash_xml());       // FLASHJS广告

4、index_ad.lbi:

  1. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">

  2. <!-- {if $index_ad eq 'sys'} -->

  3. <script type="text/javascript">

  4. var swf_width=534;

  5. var swf_height=200;

  6. </script>

  7. <script type="text/javascript" src="data/flashdata/{$flash_theme}/cycle_image.js"></script>

  8. <!-- {elseif $index_ad eq 'cus'} -->

  9. <!-- {if $ad.ad_type eq 0} -->

  10. <a href="{$ad.url}" target="_blank"><img src="{$ad.content}" width="534" height="200" border="0"></a>

  11. <!-- {elseif $ad.ad_type eq 1} -->

  12. <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="534" height="200">

  13. <param name="movie" value="{$ad.content}" />

  14. <param name="quality" value="high" />

  15. <embed src="{$ad.content}" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="534" height="200"></embed>

  16. </object>

  17. <!-- {elseif $ad.ad_type eq 2} -->

  18. <div id="picBox">

  19. <ul id="show_pic" style="left:0;">

  20. {foreach from=$playerdb item=item key=key}

  21. <li><a href="{$item.url}" target="_blank"><img src="{$item.src}" alt="{$item.text}" /></a></li>

  22. {/foreach}

  23. </ul>

  24. <ul id="icon_num">

  25. {foreach from=$playerdb item=item name=picsitem key=key}

  26. <li <!--{if $smarty.foreach.picsitem.iteration eq 1}-->class="active" <!--{/if}-->>{$item.text}</li>

  27. {/foreach}

  28. </ul>

  29. </div>

  30. {$ad.content}

  31. <!-- {elseif $ad.ad_type eq 3} -->

  32. <a href="{$ad.url}" target="_blank">{$ad.content}</a>

  33. <!-- {/if} -->

  34. <!-- {else} -->

  35. <!-- {/if} -->

5、CSS文件

  1. #picBox{width:534px; height:232px; overflow:hidden; position:relative; z-index:999;border:1px solid #0000ff}

  2. #picBox ul#show_pic{height:202px; width:3050px; position:absolute;}

  3. #picBox ul#show_pic li{ float:left; height:202px;}

  4. #picBox ul#show_pic li img{ display:block; width:534px;height:200px}

  5. #icon_num{ position:absolute; bottom:0px; left:0px;width:534px; overflow:hidden;}

  6. #icon_num li { float:left;background:#565662; font-weight:bold;color:#fff; display:block;cursor:pointer;width:135px;padding:5px;text-align:center; border-right:1px solid #fff; font-size:13px;}

  7. #icon_num li:hover,#icon_num li.active{ background:#000000; color: red;}

(0)

相关推荐