时间:2021-07-01 10:21:17 帮助过:18人阅读
class WebAction extends BaseAction {
/**
* 显示在页面 smarty注入
*/
public function index() {
$this->checkAccess('team');
// $this->assign("news",$this->fNews());
// $this->fNews();
// $this->assign("oneNews",$this->fOneNews());
$this->display();
}
/**
* 查询网站基本信息
* @return Ambigous
*/
public function find() {
$this->checkAccess('team');
$m = M("web");
$web = $m->find();
$this->assign("web", $web); //赋值数据集
$this->display("Web/index");
}
/**
* 查询进入帮助中心显示的文章
* @return Ambigous
*/
public function fOneNews() {
$this->checkAccess('team');
$type['id'] = $_GET['id'] ? $_GET['id'] : 1; //二元运算 如果 存在$_GET['id'] 赋值本身 不存在为假赋值为1
$oneNews = M("news")->where($type)->select();
return $oneNews;
}
/**
* 跳转到添加文章分类页面
*/
public function create() {
$this->checkAccess('team');
$nType = new NewListAction();
$webType = $nType->fNewsType();
$this->assign("newsType", $webType);
$this->display("News:newsFrom");
}
public function update() {
class WebAction extends BaseAction {
public function index() {
$this->checkAccess('team');
// $this->assign("news",$this->fNews());
// $this->fNews();
// $this->assign("oneNews",$this->fOneNews());
$this->display();
}
public function find() {
$this->checkAccess('team');
$m = M("web");
$web = $m->find();
$this->assign("web", $web); //赋值数据集
$this->display("Web/index");
}
public function fOneNews() {
$this->checkAccess('team');
$type['id'] = $_GET['id'] ? $_GET['id'] : 1; //二元运算 如果 存在$_GET['id'] 赋值本身 不存在为假赋值为1
$oneNews = M("news")->where($type)->select();
return $oneNews;
}
public function create() {
$this->checkAccess('team');
$nType = new NewListAction();
$webType = $nType->fNewsType();
$this->assign("newsType", $webType);
$this->display("News:newsFrom");
}
public function update() {
$this->checkAccess('team');
$where['id'] = I('nid', '', 'trim'); //网站名称
$web['webname'] = I('name', '', 'trim'); //网站名称
...
$add = M("Web");
// $add->create($web)
$result = $add->where($where)->save($web);
if ($result) {
$this->success("操作成功!");
} else {
$this->error("操作失败");
}
}
}
[1,
2,
3,
]