//前台回显 <select name="cat_id"> <option value="">选择分类</option> <?php foreach ($catData as $k => $v): if($v[‘id‘] == $data[‘cat_id‘]) $select = ‘selected="selected"‘; else $select = ‘‘; ?> <option {$select} value="{$v.id}"><?php echo str_repeat(‘-‘,$v[‘level‘] * 8); ?>{$v.cat_name}</option> <?php endforeach; ?> </select> //后台输出数据 // 取出所有的商品类型 $typeModel = M(‘Type‘); $typeData = $typeModel->select(); $this->assign(‘typeData‘, $typeData); // 取出所有的商品分类 $catModel = D(‘Category‘); $catData = $catModel->getTree(); $this->assign(‘catData‘, $catData); // 取出所有的品牌 $brandModel = M(‘Brand‘); $brandData = $brandModel->select(); $this->assign(‘brandData‘, $brandData); // 取出所有的会员级别 $mlModel = M(‘MemberLevel‘); $mlData = $mlModel->select(); $this->assign(‘mlData‘, $mlData);
时间: 2024-10-14 12:10:29