thinkphp 根据无限极分类添加内容 小弟在线急求答案 跟写法 thinkphp类function 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 无极限分类你已经弄好了,添加具体的新闻内容,比无极限分类还简单的啊!分类ID 保存到新闻 中的分类ID字段里就好了! 给你个我这边的无极限分类 `brand_id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '1-1000为品牌1000以后为品牌下产品分类', `name` varchar(255) NOT NULL COMMENT '名称', `add_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '添加时间', `parent_id` int(5) unsigned NOT NULL DEFAULT '0' COMMENT '所属父栏目ID', `arr_parent_id` varchar(255) NOT NULL DEFAULT '' COMMENT '所有父栏目', `arr_child_id` text NOT NULL COMMENT '所有子栏目', `is_child` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '是否有子栏目', `level` int(2) unsigned NOT NULL DEFAULT '0' COMMENT '类型的深度级别,越是下级的分类,该值越大',分类控制器添加/** * 新增 */ public function add() { $D=M('Brand'); if(IS_POST) { $data = $D->create(); if($data) { if(empty($data['name'])) { $this->error('名称不能为空'); } $id = $D->add(); if($id) { $D->cacheClear(true); $this->success('新增成功', U('index')); } else { $this->error('新增失败'); } } else { $this->error($D->getError()); } } else { $pid = I('get.parent_id', 0, 'intval');//生成分类树 $this->assign('_Tree',From::selectCategory(getBrand(),$pid,'size="" class="col-xs-12 col-sm-2" name="brand_id"','请选择栏目',0,['idName'=>'brand_id'])); $this->meta_title = '新增'; $this->display('edit'); } } function add(){换成你的内容模型表单就换成内容参数值得表单 $cate=new NavigationModel('cate'); if($vo=$cate->create()){ if($cate->add()){ $this->success('添加成功'); }else{ $this->error('添加栏目失败'); } }else{ $this->error($cate->getError()); } } Spreadsheet_Excel_Writer生成文件,下载后是乱码. 急!求一库存管理系统(袖珍型) php+js倒计时循环 冒泡,有做网站的喊下了 纠结的字符编码转换 求购这种站293.net 资源 正则提取中文前三位 php相关问题,高手帮忙讲解一下原理 求一个apache 的rewrite语句。 这是怎么回事?base64解密后就是图片,什么也看不见 PHP怎么做银联的支付接口调用 这种情况如何处理呢
分类ID 保存到新闻 中的分类ID字段里就好了!
`name` varchar(255) NOT NULL COMMENT '名称',
`add_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '添加时间',
`parent_id` int(5) unsigned NOT NULL DEFAULT '0' COMMENT '所属父栏目ID',
`arr_parent_id` varchar(255) NOT NULL DEFAULT '' COMMENT '所有父栏目',
`arr_child_id` text NOT NULL COMMENT '所有子栏目',
`is_child` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '是否有子栏目',
`level` int(2) unsigned NOT NULL DEFAULT '0' COMMENT '类型的深度级别,越是下级的分类,该值越大',
分类控制器添加
/**
* 新增
*/
public function add() {
$D=M('Brand');
if(IS_POST) {
$data = $D->create();
if($data) {
if(empty($data['name'])) {
$this->error('名称不能为空');
}
$id = $D->add();
if($id) {
$D->cacheClear(true);
$this->success('新增成功', U('index'));
} else {
$this->error('新增失败');
}
} else {
$this->error($D->getError());
}
} else {
$pid = I('get.parent_id', 0, 'intval');
//生成分类树
$this->assign('_Tree',From::selectCategory(getBrand(),$pid,'size="" class="col-xs-12 col-sm-2" name="brand_id"','请选择栏目',0,['idName'=>'brand_id']));
$this->meta_title = '新增';
$this->display('edit');
}
}
function add(){
换成你的内容模型
表单就换成内容参数值得表单
$cate=new NavigationModel('cate');
if($vo=$cate->create()){
if($cate->add()){
$this->success('添加成功');
}else{
$this->error('添加栏目失败');
}
}else{
$this->error($cate->getError());
}
}