利用ecshop的flash,在产品页下面(或当前产品页),轮番显示产品库的图片代码分享
利用ecshop的flash,在产品页下面(或当前产品页),轮番显示产品库的图片代码分享
* Hacks by xoao.com
- <?php
- /**
- * ECSHOP 轮播显示当前产品图片程序
- *修改自ecshop 原幻灯片轮番程序
- */
- define('IN_ECS', true);
- define('INIT_NO_USERS', true);
- define('INIT_NO_SMARTY', true);
- require('./includes/init.php');
- header('Content-Type: application/xml; charset=utf-8');
- header('Cache-Control: no-cache, must-revalidate');
- header('Expires: Thu, 27 Mar 1975 07:38:00 GMT');
- header('Last-Modified: ' . date('r'));
- header('Pragma: no-cache');
- $goods_id = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : 0;
- $sql = 'SELECT img_id, img_desc, thumb_url, img_url'.
- ' FROM ' .$ecs->table('goods_gallery').
- " WHERE goods_id = '$goods_id' ORDER BY img_id";
- $img_list = $db->getAll($sql);
- $img_count = count($img_list);
- if ($img_count == 0)
- {
- /* 如果没有图片,返回商品详情页 */
- header('Location: goods.php?id=' . $_REQUEST['id'] . "\n");
- exit;
- }
- else
- {
- echo '<?xml version="1.0" encoding="utf-8"?><bcaster>';
- for ( $i = 0; $i < $img_count; $i++ )
- {
- echo '<item item_url="'. $img_list[$i]['img_url'] . '" link="gallery.php?id=' . $goods_id .'" />';
- }
- echo '</bcaster>';
- }
- ?>
另存为:cycle_con_img.php(这段代码生成的将是xml的格式,ecshop的幻灯片是读取xml的)
上传到根目录。
前台:拷贝ecshop首页的默认的flash的幻灯片代码到goods.dwt的想放的位置
将幻灯片里代码
- data/images/bcastr.swf?bcastr_xml_url=cycle_image.php
记得是两处
这样,产品库的图片就能在goods页显示幻灯片了。
如果你是第一次来这儿,欢迎订阅
RSS feed。 第一时间看到更多精彩内容,谢谢你的访问!
原文地址:http://my.xoao.com/ecshop-flash-show-img
转载请注明出处,非常感谢!
admin on 01月 20th, 2008 | File Under PHP | -
原文地址:http://my.xoao.com/ecshop-flash-show-img
转载请注明出处,非常感谢!