3.打开index.php,在大约164行找到
$smarty->display('index.dwt', $cache_id);
在此行下面插入
function get_flash_xml()
{
$flashdb = array();
if (file_exists(ROOT_PATH . DATA_DIR . '/flash_data.xml'))
{
// 相容v2.7.0及以前版本
if (!preg_match_all('/item_url="([^"]+)"\slink="([^"]+)"\stext="([^"]*)"\ssort="([^"]*)"/', file_get_contents(ROOT_PATH . DATA_DIR . '/flash_data.xml'), $t, PREG_SET_ORDER))
{
preg_match_all('/item_url="([^"]+)"\slink="([^"]+)"\stext="([^"]*)"/', file_get_contents(ROOT_PATH . DATA_DIR . '/flash_data.xml'), $t, PREG_SET_ORDER);
}
if (!empty($t))
{
foreach ($t as $key => $val)
{
$val[4] = isset($val[4]) ? $val[4] : 0;
$flashdb[] = array('src'=>$val[1],'url'=>$val[2],'text'=>$val[3],'sort'=>$val[4]);
}
}
}
return $flashdb;
}
4.同样index.php,在大约129行找到
$smarty->assign('auction_list', index_get_auction()); // 拍卖活动
在此行下面插入:
$smarty->assign('playerdb', get_flash_xml()); // CSS+JS广告轮播
5.打开ecshop的/themes/使用中模版/library/index_ad.lbi,将内容全部删除,然后将下列代码插入:
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- {if $index_ad eq 'sys'} -->
<script type="text/javascript">
var swf_width=710;
var swf_height=260;
</script>
<script type="text/javascript" src="data/flashdata/{$flash_theme}/cycle_image.js"></script>
<!-- {elseif $index_ad eq 'cus'} -->
<!-- {if $ad.ad_type eq 0} -->
<a href="{$ad.url}"><img src="{$ad.content}" width="710" height="260" border="0" /></a>
<!-- {elseif $ad.ad_type eq 1} -->
<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="710" height="260">
<param name="movie" value="{$ad.content}" />
<param name="quality" value="high" />
<embed src="{$ad.content}" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="710" height="260"></embed>
</object>
<!-- {elseif $ad.ad_type eq 2} -->
<div id="picBox">
<ul id="show_pic" style="left:0;">
{foreach from=$playerdb item=item key=key}
<li><a href="{$item.url}"><img src="{$item.src}"/></a></li>
{/foreach}
</ul>
</div>
<div id="picBox1">
<ul id="icon_num">
{foreach from=$playerdb item=item name=picsitem key=key}
<li <!--{if $smarty.foreach.picsitem.iteration eq 1}-->class="active" <!--{/if}-->>{$item.text|truncate:7}</li>
{/foreach}
</ul>
</div>
{$ad.content}
<!-- {elseif $ad.ad_type eq 3} -->
<a href="{$ad.url}">{$ad.content}</a>
<!-- {/if} -->
<!-- {else} -->
<!-- {/if} -->
6.打开/themes/使用中模版/style.css,在最下面插入以下代码:
/* Flash首页主广告轮播替换为Js轮播 - www.ldhost.cn */
#picBox{width:710px; height:260px; overflow:hidden; position:relative; z-index:999;border:0px solid #CCCCCC;}
#picBox1{width:710px; height:30px; overflow:hidden; position:relative; z-index:999;border:0px solid #CCCCCC;}
#picBox ul#show_pic{height:260px; width:3550px; position:absolute;}
#picBox ul#show_pic li{ float:left; height:260px;}
#picBox ul#show_pic li img{ display:block; width:710px;height:260px}
#icon_num{ position:absolute; bottom:0px; left:0px;width:710px; height: 30px; overflow:hidden; padding-right:0px;}
#icon_num li {float:left;background:#cccccc;filter:alpha(opacity=80); /* IE 透明度20% */-moz-opacity:0.8; /* Moz FF 透明度10%*/opacity: 0.8; /* 支持CSS3的浏览器(FF 1.5也支持)透明度10%*/ font-weight:bold;color:#777; border:1px #ccc solid;cursor:pointer;width:140px; line-height:30px;text-align:center; font-size:13px; background:#cccccc;}
#icon_num li:hover,#icon_num li.active{background:url(images/tab_arrow_down.gif) #7d7d7d no-repeat center -1px; color:#fff; text-align:center}
/*end*/
好模板教程完毕
(责任编辑:好模板) |