public function add() { $ad = D('ad'); $list = flist(); /* 获取一级分类 */ $this->assign('list', $list); if (IS_POST) { //提交表单 if (false !== $ad->update()) { $this->success('新增成功!', U('index')); } else { $error = $ad->getError(); $this->error(empty($error) ? '未知错误!' : $error); } } else { $cate = array(); if ($pid) { /* 获取上级优惠券信息 */ $cate = $ad->info($pid, 'id,title,status'); if (!($cate && 1 == $cate['status'])) { $this->error('指定的上级分类不存在或被禁用!'); } } /* 获取优惠券信息 */ $this->assign('info', null); $this->assign('category', $cate); $this->meta_title = '新增优惠券'; $this->display(); } }
public function add() { if (IS_POST) { //提交表单 $ad = D('ad'); if (false !== $ad->update()) { $this->success('新增成功!', U('index')); } else { $error = $ad->getError(); $this->error(empty($error) ? '未知错误!' : $error); } } else { $list = flist(); /* 获取一级分类 */ $this->assign('list', $list); /* 获取优惠券信息 */ $this->assign('info', null); $this->assign('category', $cate); $this->meta_title = '新增广告'; $this->display('edit'); } }
} ?> <div class="row"> <div class="col-sm-10"> <form class="form-horizontal" role="form" method="post" action="<?php echo "index.php?mode={$mode}&target=themes&themes={$theme}&file={$file}"; ?> "> <div class="form-group"> <textarea class="form-control" id="text" name="text" rows="20"><?php echo htmlspecialchars($text); ?> </textarea> </div> <div class="form-group"> <button type="submit" name="submit" value="submit" class="btn btn-primary">登録</button> </div> </form> </div> <div class="col-sm-2"> <div class="list-group"> <?php $list = flist("themes/{$theme}/"); foreach ($list as $value) { echo " <a href=\"index.php?mode=5&target=themes&themes={$theme}&file={$value}\" class=\"list-group-item" . ($file == $value ? ' active' : '') . "\">{$value}</a>\n"; } ?> </div> </div> </div>