下面就来研究一下调用最新列表
例:ouyoyo.com/home/
首先在uchome目录下index.php,大约在7行"include_once('./common.php');"下面加上:
//商品列表
$goodslist = array();
$query = $_SGLOBAL['db']->query("SELECT goods_id,goods_name FROM ecs_goods ORDER BY goods_id DESC LIMIT 0,6");
while ($value = $_SGLOBAL['db']->fetch_array($query)) {
$goodslist[] = $value;
}
!我的ecshop数据库和uchome的在一起
之后打开uchome使用的模板目录下index.htm
在你想要的位置加上
<div id="goodsList">
<h2>最新商品上架</h2>
<ul>
<>
<li>
<p>
<a href="http://$_SERVER['HTTP_HOST']/shop/goods.php?id=$value[goods_id]" title="$value[goods_name]">
<img src="http://$_SERVER['HTTP_HOST']/shop/getImg.php?i=$value[goods_id]" alt="$value[goods_name]"/>
</a>
</p>
<p>
<a href="http://$_SERVER['HTTP_HOST']/shop/goods.php?id=$value[goods_id]" title="$value[goods_name]">
$value[goods_name]
</a>
</p>
</li>
<>
</ul>
</div>
这样uchome就会显示最新上架商品