微擎二级分类分析
来源:互联网 发布:单片机做成mp3 编辑:程序博客网 时间:2024/06/08 08:21
function tpl_form_field_category_pfxm2level($namepfxm, $parentpfxms, $childrenpfxm, $pingfenid1, $pingfenid2){$html = '<script type="text/javascript">window._' . $namepfxm . ' = ' . json_encode($childrenpfxm) . ';</script>';if (!defined('TPL_INIT_CATEGORYY')) {$html .= '<script type="text/javascript">function renderCategory(obj, name){var index = obj.options[obj.selectedIndex].value;require([\'jquery\', \'util\'], function($, u){$selectChild = $(\'#\'+name+\'_child\');var html = \'<option value="0">请选择二级分类</option>\';if (!window[\'_\'+name] || !window[\'_\'+name][index]) {$selectChild.html(html);return false;}for(var i=0; i< window[\'_\'+name][index].length; i++){html += \'<option value="\'+window[\'_\'+name][index][i][\'id\']+\'">\'+window[\'_\'+name][index][i][\'name\']+\'</option>\';}$selectChild.html(html);});}</script>';define('TPL_INIT_CATEGORYY', true);}$html .='<div class="row row-fix tpl-category-container"><div class="col-xs-12 col-sm-6 col-md-6 col-lg-6"><select class="form-control tpl-category-parent we7-select" id="' . $namepfxm . '_parent" name="' . $namepfxm . '[pingfenid1]" onchange="renderCategory(this,\'' . $namepfxm . '\')"><option value="0">请选择一级分类</option>';$ops = '';if(!empty($parentpfxms)) {foreach ($parentpfxms as $row) {$html .= '<option value="' . $row['id'] . '" ' . (($row['id'] == $pingfenid1) ? 'selected="selected"' : '') . '>' . $row['name'] . '</option>';}}$html .= '</select></div><div class="col-xs-12 col-sm-6 col-md-6 col-lg-6"><select class="form-control tpl-category-child we7-select" id="' . $namepfxm . '_child" name="' . $namepfxm . '[pingfenid2]"><option value="0">请选择二级分类</option>';if (!empty($pingfenid1) && !empty($childrenpfxm[$pingfenid1])) {foreach ($childrenpfxm[$pingfenid1] as $row) {$html .= '<option value="' . $row['id'] . '"' . (($row['id'] == $pingfenid2) ? 'selected="selected"' : '') . '>' . $row['name'] . '</option>';}}$html .= '</select></div></div>';return $html;}
model.php 文件如上:
inc 函数文件中如下
//把下面所有变量变成新带参数$categorypfxm = pdo_fetchall("SELECT id,parentid,name FROM " . tablename($this->tb_categorypfxm) . " WHERE uniacid = '{$_W['uniacid']}' ORDER BY parentid ASC, displayorder ASC, id ASC ", array() , 'id');$parentpfxm = array();$childrenpfxm = array();if (!empty($categorypfxm)) { $childrenpfxm = ''; foreach ($categorypfxm as $cidpfxm => $catepfxm) { if (!empty($catepfxm['parentid'])) { $childrenpfxm[$catepfxm['parentid']][] = $catepfxm; } else { $parentpfxm[$catepfxm['id']] = $catepfxm; } }}
post编辑页面需要返回值,还需要修订下。
//下面的IF是返回值的关键 if (!empty($id)) { $item = pdo_fetch("SELECT * FROM " . tablename($this->tb_articleqsgl) . " WHERE id = :id", array( ':id' => $id )); $item['type'] = explode(',', $item['type']); $pcate = $item['pcate']; $ccate = $item['ccate']; $pingfenid1 = $item['pingfenid1'];//这里错了一个$item $pingfenid2 = $item['pingfenid2'];//这里错了一个$item if (empty($item)) { message('抱歉,判分记录不存在或是已经删除!', '', 'error'); } $item['credit'] = iunserializer($item['credit']) ? iunserializer($item['credit']) : array(); } else { $item['credit'] = array(); }
阅读全文
0 0
- 微擎二级分类分析
- codis 二级分类 二级索引
- 二级分类算法
- ecshop 二级分类技巧
- 漂亮的二级分类
- dedecms二级分类
- Yii中的二级分类
- 分类二级列表
- 下拉框二级分类关联
- ASP二级分类联动菜单
- python django二级分类表现
- 二级文章分类调用格式化
- Android二级分类列表ListView
- Android二级分类列表GirdView
- aspcms 一级分类 二级分类调用
- thinkphp调用二级栏目(二级分类) 函数+模板 完整代码
- thinkphp调用二级栏目(二级分类) 函数+模板 完整代码
- 十二级分类晕之道
- Maven教程
- scala 奇淫巧技
- VBA与Excel进阶系列-03-图表(下篇)
- 正则表达式 备忘录
- 数三角形
- 微擎二级分类分析
- iOS 每天凌晨发送通知更新界面
- Swordfish
- bfs广搜 胜利大逃亡 HDU
- Spring form标签示例
- EBS调用交叉验证规则校验外围系统导入凭证
- 基于灰度的模板匹配算法(一):MAD、SAD、SSD、MSD、NCC、SSDA算法
- QT和opencv 相结合的软件,自己搭建的。
- CSS中margin和padding的区别