//获取产品属性
function get_mall_spec($goods_id,$db){
$strSql="select * from ecm_goods_spec where goods_id=$goods_id limit 0,1";
$query=$db->query($strSql);
if ( $iteminfo = $db->fetch_array( $query ) ) {
$iteminfo['image']=get_thumb_img($iteminfo['default_image']);
return $iteminfo;

return null;
}//获取缩略图路径
function get_thumb_img($d){
define('ECM_KEY','63f102254c6fbe018590f4c0a6e0b5fc');
$arr=array('file'=>$d,'width'=>120,'height'=>120);
$hash_path = md5( ECM_KEY.$arr['file'].$arr['width'].$arr['height'] );
$thumb_path = "http://localhost/nihao/mall/temp/thumb/".$hash_path[0].$hash_path[1]."/".$hash_path[2].$hash_path[3]."/".$hash_path.$arr['file'].".jpg";
return $thumb_path;
}//最新的推荐图片产品
$strSql="select * from ecm_goods where is_mi_best=1 order by last_update desc limit 0,18";
$query = $_SGLOBAL['db']->query($strSql);
while ($item = $_SGLOBAL['db']->fetch_array($query)) {
$item['spec']=get_mall_spec($item['goods_id'],$_SGLOBAL['db']);
$item['jieshen']=$item['spec']['et_price']-$item['spec']['store_price'];
$mall_new[] = $item;
}以上代码要用在模板中用<!--{loop $mall_new $value}-->
来调用,但不显示,直接在php文件中echo 可以显示出来  discuz模板引擎