首页 > 学院 > 开发设计 > 正文

IWEBSHOP开发一

2019-11-14 11:09:33
字体:
来源:转载
供稿:网友
关于iwebshop开发的几点总结:模板中统计个数:1、全部商品总数1、{query:name=goods fields=count(*) as countNums}<span class="count">{$item['countNums']}</span>{/query} 2、最新商品总数【商品推荐类型commend_id:最新商品1  特价商品2  热卖商品3  推荐商品4】2、{query:name=commend_goods fields=count(*) as newNums where=`commend_id` eq 1}<span class="count">{$item['newNums']}</span>{/query}【排除 下架商品】{query:name=commend_goods as cg join=left join goods as gd on cg.goods_id eq gd.id fields=count(*) as newNums where=gd.is_del eq 0 and cg.commend_id eq 1}3、if、else结构{if:$this->goodsList}  {else:}{/if}4、分页{$goodsObj->getPageBar()}5、赋值 {set:$tmpId=$item['id'];}    6、foreach【$key自带】{foreach:items=$photo}{$item['name']}【都是item['XX']】{if:$key == '0'}键测试{/if}{/foreach}7、判断是否存在{if:isset($photo) && $photo}{/if}8、获取详情信息    {foreach:items=Api::run('getGoodsInfo',array('#id#',$id))}        <img src="{webroot:$item[img]}"/>    {/foreach}        9、数组赋值{set:$SEO_data['title'].="_".$site_config->name}{set:$seo_data['keyWords']=$this->catRow['keywords']}{set:$seo_data['description']=$this->catRow['descript']}{set:seo::set($seo_data);}10、模板文件:电脑版views/default手机版views/mobile手机版为例:公共头尾文件views/mobile/layouts/site.html购物车头尾文件:views/mobile/layouts/site_mini.html公共会员中心头尾文件:views/mobile/layouts/ucenter.html11、两种列表读取及其分页展示:一、php读取前台遍历PHP: public function orders_list(){$page = IReq::get('page') ? IFilter::act(IReq::get('page'),'int') : 1;//页数$tb_userOrder = new IQuery('user_addorder');//表$tb_userOrder->order  = "addTime desc";//排序$tb_userOrder->page = $page;//页数$tb_userOrder->pagesize = '10';//分页个数$orderList = $tb_userOrder->find();//数组读取$this->orderList = $orderList;//肤质$this->pageBar = $tb_userOrder->getPageBar();//分页赋值$this->redirect('orders_list');} 模板: {foreach:items=$this->orderList}      {$item['username']}{/foreach}{$this->pageBar} 二、完全在模板中php:function members_list(){$this->redirect('members_list');}模板:{set:$page= (isset($_GET['page'])&&(intval($_GET['page'])>0))?intval($_GET['page']):1;}{query: name=user_add order=addTime desc page=$page pagesize=15}       {$item['username']}{/query} {$query->getPageBar()} 
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表