<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>後台管理</title>
<link rel="stylesheet" type="text/css" href="__PUBLIC__/css/common.css"/>
<link rel="stylesheet" type="text/css" href="__PUBLIC__/css/main.css"/>
<script type="text/javascript" src="__PUBLIC__/js/libs/modernizr.min.js"></script>
<script type="text/javascript" src="__PUBLIC__/ueditor/ueditor.config.js "></script>
<script type="text/javascript" src="__PUBLIC__/ueditor/ueditor.all.min.js"></script>
<script type="text/javascript" src="__PUBLIC__/ueditor/lang/zh-cn/zh-cn.js"></script>
</head>
<body>
<include file="Public/head" />
<div class="container clearfix">
<include file="Public/left" />
<div class="main-wrap">
<div class="crumb-wrap">
<div class="crumb-list"><i class="icon-font"></i><a href="/jscss/admin/design/" >首页</a><span class="crumb-step">></span><a class="crumb-name" href="/jscss/admin/design/">文章管理</a><span class="crumb-step">></span><span>新しい文章</span></div>
< ;/div>;
<div class="result-wrap">
<div class="result-content">
<form action="" Method="post" id="myform" name="myform" enctype="multipart/form-data">
<input type="hidden" name="id" value="{$ Articler.id}">
<table class="insert-tab" width="100%">
<tbody>
<tr> ;
<th><i class="require-red">*</i>文章名:</th>
<td>
<input class="common-text required" id="catename" name="title" size="50" value="{$articler.title}" type="text">
</td>
</tr>
<tr>
<td>
<textarea style="width:420px;height:100px;" name="desc">{$articler.desc}</textarea>
</td>
</tr>
<tr>
<th><i class="require-red">*</i>缩略図:</th>
<td>
< ;input id="pic" name="pic" size="50" value="" type="file">
<ifcondition="$articler['pic'] neq '' ">
<img src="__ROOT__{$articler.pic}" height="50">
<else/>
暂無し画像
</if>
</td>
</tr&g t;
<tr>
<th><i class="require-red">*</i> 所属栏目:</th>
<td>
<名前を選択してください="cateid">
<option >选择分类</option>
<volist name="cateres" id="vo">
<option <ifcondition="$vo['id'] eq $articler['cateid']">selected="selected"</if> value="{$vo.id}">{$vo.catename}</option>
</volist>
< ;/select>
</td>
</tr>
<tr>
<td>
<textarea name="content" id="content " >{$articler.content}</textarea>
</td>
</tr>
<tr>
<th></th>
<td>
<input class="btn btn-primary btn6 mr10" value="提交" type="submit" &gt;
&lt; input class = "btn btn6" onclick = "history.go(-1)" value = "返回" type = "button"&gt;
&lt;/td&gt ;
</tr>
</tbody></table>
</form>
< /div>
</div>
</div>gt;
<!--/main-->gt;
</div>
<script type="text/javascript">
UE.getEditor('content',{initialFrameWidth:1000,initialFrameHeight:200,});
</script> ;
</body>
</html>
<?php
namespace AdminController;
use ThinkController;
class ArticleController extends Controller {
Public function lst(){
if($article->create($date)){
if($article->add()){
$this->success('追加文章成功',U('lst') );
}else{
$this->error('添加文章失败!');
}
}else{
$this->error($article->getError()) ;
}
return;
}
$cateres=D('cate')->select();
$this->assign('cateres',$cateres);
$this ->display();
}
public function edit(){
//实例化
$article=D('article');
if(IS_POST){
$date['タイトル']=I('title');
$date['content']=I('content');
$date['desc']=I('desc');
$date[' cateid']=I('cateid');
if($_FILES['pic']['tmp_name']!=''){
$upload = new ThinkUpload();// 实例化上传类
$upload->maxSize=3145728 ;// 設置アクセサリ上传大小
$upload->exts =array('jpg', 'gif', 'png', 'jpeg');//型
$upload->rootPath= './'; // 設置付属品上传根目录
$upload->savePath ='/Public/Uploads/'; // 設置付属品上传(子)目录
// 上传单个文件
$info = $upload->uploadOne($_FILES['pic']);
if(!$ info) {// 上传错误提案错误情報
$this->error($upload->getError());
}else{// 上传成功获取上传文件情報
$date['pic']=$info['savepath '].$info['savename'];
}
}else{
}
if($article->create($date)){
if($article->save()){
$this->success('修正文章成功',U('lst') );
}else{
$this->error('修正文章失败!');
}
}else{
$this->error($article->getError()) ;
}
return;
}
$articler=$article->find(I('id'));
$this->assign('articler',$articler);
$cateres=D('cate')->select();
$this->assign('cateres',$cateres);
$this->display();
}
public function del(){
//实例化
$article=D('article');
if($article->delete(I('id'))){
$this ->success('删除文章成功!',U('lst'));
}else{
$this->error('删除文章失败!');
}
}
public function sort(){
//var_dump($_POST); //打成一排
//dump($_POST); //分行打现来
$article=D('article');
foreach ($_POST as $id => $sort) {
// code...
$article->where (array('id'=>$id))->setField('sort',$sort);
}
$this->success('排序更新成功!',U('lst' ));
}
}