1.ecshop基本前台显示功能

if ($_REQUEST['act'] == 'list')
{

$smarty->assign('action', $_REQUEST['act']);

$where = 'where 1';//横真
$where .= " AND goods_name<>'' ";//判断字段不为空
$where .= " AND cat_id =2934 ";//指定表中字段特定ID


$listm = $GLOBALS['db']->getAll("SELECT goods_id,cat_id, goods_name,last_update FROM " .$GLOBALS['ecs']->table('goods').$where."limit 25" );//数据库中查询

$smarty->assign('listm',$listm);//赋值
$smarty->display('shangpin.dwt');//执行php文件
<table class="ve-table">
  <tbody>
    <tr class="length-01">
      <th>商品名称</th>
      <th>最新更新时间</th></tr>
    <!-- {foreach from=$listm item=list }-->//遍历二维数组
    <tr>
      <td class="length-01">
        <a href="shangpin.php?id={$list.goods_id}">
          <span style="color:red;">*</span>&nbsp;&nbsp;{$list.goods_name}</a></td>//输出名称
      <td class="length-01">
        <a href="shangpin.php?id={$list.goods_id}">&nbsp;&nbsp;{$list.last_update}</a></td>
    </tr>
    <!--{/foreach}--></tbody>
</table>

//  

 

posted @ 2016-06-02 16:33  xbaobao  阅读(273)  评论(0)    收藏  举报