微擎二级分类分析

function tpl_form_field_category_pfxm2level($namepfxm, $parentpfxms, $childrenpfxm, $pingfenid1, $pingfenid2){
	$html = '
		';
			if (!defined('TPL_INIT_CATEGORYY')) {
				$html .= '
		
					';
				define('TPL_INIT_CATEGORYY', true);
			}

			$html .=
				'
'; 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();
    }



你可能感兴趣的:(微擎,微擎)