class SectionModel extends Model{
//表单数据验证
protected $_validate=array(
array('title','require','分类名称必须填写',1,'regex',3),
);
protected $_auto=array(
array('alias','getAlias',1,'callback'),
);
function getAlias(){
if(empty($_POST['alias'])){
return date('Y-m-d-H-i-s');
}else{
return $_POST[];
}
}
protected $_map=array();
}
class SectionAction extends Action{
function index(){}
function add(){}
function edit(){}
function delete(){}
function insert(){}
function search(){}
}
整合fckEdit编辑器:
1.下载编辑器,放到public 下面,并且在public 下面新建uploads文件夹用来保存上传图片位置
2.引入核心js
<script src="__PUBLIC__/fckEditor/fckediror.js"></script>
<textarea name="description"></textarea>
3.初始化
<script>
function onloadFck(){
var fck=new FCKeditor('description');
fck.BasePath="__PUBLIC__/fckeditor/";
fck.Width="700";
fck.Height="300";
fck.ReplaceTextarea();
}
window.οnlοad=onloadFck;
</script>
4.修改配置文件
class CategoryViewModel extends ViewModel{
public $viewFields=array(
'Category'=>array(
'id'=>'cid',
'title'=>'ctitle',
'alias'=>'clias',
'published'=>'cpublicshed',
'order'=>'corder',
'access'=>'caccess',
'sectionid',
),
'Section'=>array(
'id'=>'sid',
'title'=>'sec_name',
'_on'=>'Category.sectionid=Section.id'
),
);
}
class CategoryAction extends Action{
function index(){
$cat=new CategoryViewModel();
$list=$cat->select();
}
}