1 showmessage()showmessage(L( operation_success ), ?m=link&c=link&a=edit , , e
1.showmessage() showmessage(L('operation_success'),'?m=link&c=link&a=edit','', 'edit'); edit==>关闭对象 showmessage(L('operation_failure')); showmessage(L('operation_false'),HTTP_REFERER); 2.formValidator 3.update() $data=array('nickname'=>$_POST['nickname'],'contact'=>$_POST ['contact'],'content'=>$_POST['content'],'posttime'=>time(),'checkinfo'=>$checkinfo); $result=$this->db->update($data,"id={$id}"); $result=$this->db->delete("id={$_GET['id']}"); $insert_id=$this->db->insert($data,true); 4.数据表名 5.listinfo() 6.对话框 function edit(id) { window.top.art.dialog({id:'edit'}).close(); window.top.art.dialog({title:'编辑留言'+' ',id:'edit',iframe:'? m=board&c=board&a=edit&id='+id,width:'700',height:'450'}, function(){var d = window.top.art.dialog({id:'edit'}).data.iframe; var form = d.document.getElementById('dosubmit');form.click();return false;}, function(){window.top.art.dialog({id:'edit'}).close()}); } function replay(id) { window.top.art.dialog({id:'replay'}).close(); window.top.art.dialog({title:'回复留言'+' ',id:'replay',iframe:'? m=board&c=board&a=replay&id='+id,width:'450',height:'200'}, function(){var d = window.top.art.dialog({id:'replay'}).data.iframe; var form = d.document.getElementById('dosubmit');form.click();return false;}, function(){window.top.art.dialog({id:'replay'}).close()}); } 7.改变状态的ajax //传id和值 function check(id,checkinfo){ $.ajax({ type:"get", url:"?m=board&c=board&a=check", data:{id:id,checkinfo:checkinfo}, dataType:"json", success:function(data){ window.location="?m=board&c=board&a=init"; } }) } public function check(){ if($_GET['checkinfo']=="true"){ $checkinfo="false"; }else{ $checkinfo="true"; } $data=array("checkinfo"=>$checkinfo); $result=$this->db->update($data,"id={$_GET['id']}"); if($result){ echo "1"; } } 7.删除全部 <a href='?m=board&c=board&a=delete&id=<?php echo $info['id']?>' onClick="return confirm('<?php echo L('confirm', array('message' =>$info['id']))?>')">删除</a> public function delete(){ if(!is_array($_POST['id'])){ $result=$this->db->delete("id={$_GET['id']}"); if($result){ showmessage(L('operation_success'),HTTP_REFERER); }else{ showmessage(L('operation_failure'),HTTP_REFERER); } }else{ foreach($_POST['id'] as $k=>$smple_id){ $result=$this->db->delete("id={$smple_id}"); if(!$result){ showmessage(L('operation_failure'),HTTP_REFERER); } } showmessage(L('operation_success'),HTTP_REFERER); } } 8.排序 <input name="dosubmit" type="submit" class="button" onClick="document.myform.action='? m=board&c=board&a=listorder'" value="<?php echo L('listorder')?>"> //更新排序 public function listorder() { if(isset($_POST['dosubmit'])) { foreach($_POST['listorders'] as $id => $orderid) { $orderid= intval($orderid); $this->db->update(array('orderid'=>$orderid),array('id'=>$id)); } showmessage(L('operation_success'),HTTP_REFERER); } }