想冲话费的去咱那看看啊
修改首页flash替换为js格式
首先在index.php中找到$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;
}
2.在$smarty->assign('shop_notice', $_CFG['shop_notice']); // 商店公告
后面添加$smarty->assign('playerdb', get_flash_xml()); // FLASHJS广告
3.我写在了index.dwt中 也可以自己写库文件。
去掉将index_ad.lbi换为index_js.lbi
4.
将他加在你需要的位置就行了额
<div id="focus_change">
<div id="focus_change_list" style="top:0; left:0;">
<ul>
<!--{foreach from=$playerdb item=play}-->
<li><a href="{$play.url}"><img src="{$play.src}" alt="美好生活网" /></a></li>
<!--{/foreach}-->
</ul>
</div>
<div class="focus_change_opacity"></div>
<div id="focus_change_btn">
<ul>
<!--{foreach from=$playerdb item=play}-->
<li class="current"><a href="{$play.url}">{$play.text}</a></li>
<!--{/foreach}-->
</ul>
</div>
</div><!--focus_change end-->
</div>
$play.src-------
》
$play.url---------》》》
$play.text-----------》》》》
Index_js.lbi
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style type="text/css">
/* Reset style */
* { margin:0; padding:0; word-break:break-all; }
/* Focus_change style */
#focus_change { position:relative; width:500px; overflow:hidden;}
#focus_change_list { position:absolute; width:2500px;}
#focus_change_list li { float:left; }
#focus_change_list li img { width:500px; height:220px; }
.focus_change_opacity { position:absolute; width:500px; height:30px; top:220px; left:0; background:#ccc; filter:alpha(opacity=50); -moz-opacity:0.5; opacity: 0.5; }
#focus_change_btn { position:absolute; width:500px; height:65px; top:220px; left:0;border-top:1px solid #FF0033; }
#focus_change_btn ul {margin:0px;padding:0px; }
#focus_change_btn li {float:left;line-height:30px;margin:0px;padding:0px; }
#focus_change_btn li a{width:100px;display:block; text-align:center; font-weight:bolder;text-decoration:none; }
#focus_change_btn .current a { background:#ff0000; color:#fff; }
</style>
<script type="text/javascript">
function $(id) { return document.getElementById(id); }
function moveElement(elementID,final_x,final_y,interval) {
if (!document.getElementById) return false;
if (!document.getElementById(elementID)) return false;
var elem = document.getElementById(elementID);
if (elem.movement) {
clearTimeout(elem.movement);
}
if (!elem.style.left) {
elem.style.left = "0px";
}
if (!elem.style.top) {
elem.style.top = "0px";
}
var xpos = parseInt(elem.style.left);
var ypos = parseInt(elem.style.top);
if (xpos == final_x && ypos == final_y) {
return true;
}
if (xpos < final_x) {
var dist = Math.ceil((final_x - xpos)/10);
xpos = xpos + dist;
}
if (xpos > final_x) {
var dist = Math.ceil((xpos - final_x)/10);
xpos = xpos - dist;
}
if (ypos < final_y) {
var dist = Math.ceil((final_y - ypos)/10);
ypos = ypos + dist;
}
if (ypos > final_y) {
var dist = Math.ceil((ypos - final_y)/10);
ypos = ypos - dist;
}
elem.style.left = xpos + "px";
elem.style.top = ypos + "px";
var repeat = "moveElement('"+elementID+"',"+final_x+","+final_y+","+interval+")"; elem.movement = setTimeout(repeat,interval);
}
function classNormal(){
var focusBtnList = $('focus_change_btn').getElementsByTagName('li');
for(var i=0; i<focusBtnList.length; i++) {
focusBtnList[i].className='';
}
}
function focusChange() {
var focusBtnList = $('focus_change_btn').getElementsByTagName('li');
focusBtnList[0].onmouseover = function() {
moveElement('focus_change_list',0,0,5);