ecshop商品象册路径的url重写
2010-09-15 20:43 来源:www.chinab4c.com 作者:admin
ecshop商品象册路径的url重写,这个是一个朋友要我帮他做的。他很细心。发现ecshop伪静态开启后。还是有很多页面没有真正的静态化.比如ecshop商品页面的商品象册地址.
1:规则
RewriteRule ^(.*)/gallery-([0-9]+)-img([0-9]+)\.html$ $1/gallery\.php\?id=$2&img_id=$3 [I]
2:includes/lib_common.php
build_uri
$args = array('cid' => 0,
'gid' => 0,
'bid' => 0,
'acid' => 0,
'aid' => 0,
'sid' => 0,
'gbid' => 0,
'auid' => 0,
'sort' => '',
'order' => '',
'img_id' =>'0',
);
case 'gallery':
if (empty($gid))
{
return false;
}
else
{
if ($rewrite)
{
$uri = 'gallery-'.$gid;
if (isset($img_id))
{
$uri .= '-img'.$img_id;
}
}
else
{
$uri = 'gallery.php?id=' . $gid;
if (isset($img_id))
{
$uri .= '&img_id=' . $img_id;
}
}
}
break;
3:includes/lib_goods.php
function get_goods_gallery($goods_id)
{
$sql = 'SELECT img_id, img_url, thumb_url, img_desc' .
' FROM ' . $GLOBALS['ecs']->table('goods_gallery') .
" WHERE goods_id = '$goods_id' LIMIT " . $GLOBALS['_CFG']['goods_gallery_number'];
$row = $GLOBALS['db']->getAll($sql);
/* 格式化相册图片路径 */
foreach($row as $key => $gallery_img)
{
$row[$key]['img_url'] = get_image_path($goods_id, $gallery_img['img_url'], false, 'gallery');
$row[$key]['thumb_url'] = get_image_path($goods_id, $gallery_img['thumb_url'], true, 'gallery');
$row[$key]['url'] = build_uri('gallery', array('gid' => $goods_id,'img_id' => $gallery_img['img_id'] ), 'xxx');
}
return $row;
}
4:library/goods_gallery.lbi
href="{$picture.url}"
最近更新
常用插件
- ecshop通用红包编码
很多时候,为了结合促销,必须扩展一下ecshop的红包功能。ecshop的红包...
- ecshop分类树中统计商品数
最近忙于开发其他项目,在不少朋友不断要求和催促的情况下,做出了该小...
- ecshop降价通知登记插件
ecshop降价通知登记插件,主要是为了方便某些客户,对商品价格要求比...
- ecshop购物车功能改进[插件
ecshop购物车功能改进[插件套餐]主要是我们最近开发工作和开发项目中。...
- ecshop红包修改成满多少减
我们在长期使用ecshop的时候,我们可以发现。ecshop的红包是一个非常强...