|
 |
|
ขอถามเรื่องประสบการณ์การทำงานหน่อยครับ ว่าใครเป็นแบบผมบ้าง |
|
 |
|
|
 |
 |
|
ปัญหาคือ ไม่ใช้ว่าเขียนโปรแกรมไม่ได้นะครับ
ปัญหาคือระบบงานของโปรแกรมเมอร์คนเก่าที่ผมต้องมา สานต่อนี่แหละ
คือ ผมอยากรู้ว่าแรกๆใครเป็นแบบผมบ้างคือ งงว่าโค้ด ที่มันเขียนมันทำไรของ เรียกนู้น เรียกนี่ ต้องมานั่งไล่พาทไฟล์
ประมาณว่าต้องมานั่งทำความเข้าใจโค้ดที่คนเก่าเขียนไว้ และ ถ้าคุณที่เจอผ่านปัญหาแบบผมนี่ คุณผ่านมันไปได้ยังไง
และถ้าคุณมีเทคนิคการไล่โค้ดคนอื่น จะดีมาก
ผมพึงทำงานได้เดือนเองอะครับ พึงจบ ขอความคิดเห็นหน่อย
ผมจะยกตัวอย่างที่ผมเจอเอาแค่ฟังก์ชันเดียวก็พอ
Code (PHP)
private function save()
{
$post = $_POST;
$file = $_FILES;
if(count($post)>0):
/*Begin : save table activities*/
$data = array();
$data['created_date'] = date("Y-m-d H:i:s",strtotime(str_replace("/",'-',$post['created_date'])));
$data['modified_date'] = date("Y-m-d H:i:s");
$data['status_select'] = $post['status_select'];
$data['cms_activity_sectors_rel'] = 1;
/*@model/cms_banner function : getOrder sequence */
$data['sequence_num'] = $this->Activity->getOrder($post['sequence_num'],NULL,1);
$commit = $this->Activity->getInsert($data);
$id = $this->Activity->getLastId('id');
/*End : save table activities_action*/
/*Begin : save table sub activities*/
$data2 = array();
$data2['title_txt'] = $post['title_txt'];
$data2['description_txtbox'] = $post['description_txtbox'];
$data2['detail_txtbox'] = $post['detail_txtbox'];
$data2['new_num'] = $post['new_num'];
/*@ function : upload*/
$data2['image_small_file'] = parent::setUpload($file['image_small_file'],$this->path."image_small/",$this->config['image_small']);
$data2['image_full_file'] = parent::setUpload($file['image_full_file'],$this->path."image_full/",$this->config['image_full']);
$data2['icon_hot_checkbox'] = empty($post['icon_hot_checkbox'])?0:1;
$data2['created_date'] = date("Y-m-d H:i:s",strtotime(str_replace("/",'-',$post['created_date'])));
$data2['modified_date'] = date("Y-m-d H:i:s");
$data2['cms_activities_rel'] = $id;
$data2['cms_langs_rel'] = 1;
$data2['cms_accounts_rel'] = 1;
$commit = $this->ActivityLang->getInsert($data2);
/*End : save table sub activities*/
endif;
/*@/extend controller function : value to view action file*/
$option = array('action'=>'save','commit'=>$commit);
if($commit==1) $this->count = $this->count+1;
$this->config['link_save_true'] = sprintf($this->config['link_save_true']);
$this->html = parent::getAction($this->config,$option);
}
private function edit()
{
$post = $_POST;
$file = $_FILES;
if(count($post)>0):
/*Begin : edit table activities*/
$data = array();
$id = $this->ref['id'];
$query['where'] = array("cms_activities_rel"=>$id);
$tmp = $this->ActivityLang->getSelect($query);
$aid = $tmp[0]['id'];
$cid = 1;
$data['cms_activity_sectors_rel'] = $cid;
$data['created_date'] = date("Y-m-d H:i:s",strtotime(str_replace("/",'-',$post['created_date'])));
$data['modified_date'] = date("Y-m-d H:i:s");
$data['status_select'] = $post['status_select'];
/*@model/cms_activity function : getOrder sequence */
if($post['sequence_num']!=$post['sequence_tmp']):
$data['sequence_num'] = $this->Activity->getOrder($post['sequence_num'],$id,$cid);
endif;
$query1['where'] = array("id"=>$id);
$commit = $this->Activity->getUpdate($query1,$data);
/*End : edit table activities*/
/*Begin : edit table sub activities*/
$data2 = array();
$data2['title_txt'] = $post['title_txt'];
$data2['detail_txtbox'] = $post['detail_txtbox'];
$data2['description_txtbox'] = $post['description_txtbox'];
$data2['new_num'] = $post['new_num'];
/*@ function : upload*/
$full =$post['image_full_tmp'];
$small =$post['image_small_tmp'];
if(!empty($file['image_small_file']['name'])):
parent::setUnlink($this->path."image_small/".$tmp[0]['image_small_file']);
$data2['image_small_file'] = parent::setUpload($file['image_small_file'],$this->path."image_small/",$this->config['image_small'],$small);
endif;
if(!empty($file['image_full_file']['name'])):
parent::setUnlink($this->path."image_full/".$tmp[0]['image_full_file']);
$data2['image_full_file'] = parent::setUpload($file['image_full_file'],$this->path."image_full/",$this->config['image_full'],$full);
endif;
$data2['tag_txt'] = $post['tag_txt'];
$data2['created_date'] = date("Y-m-d H:i:s",strtotime(str_replace("/",'-',$post['created_date'])));
$data2['modified_date'] = date("Y-m-d H:i:s");
$data2['cms_activities_rel'] = $id;
$data2['cms_langs_rel'] = 1;
$data2['cms_accounts_rel'] = 1;
$query2['where'] = array("id"=>$aid);
$commit = $this->ActivityLang->getUpdate($query2,$data2);
/*End : save table sub activities*/
endif;
/*@/extend controller function : value to view action file*/
$option = array('action'=>'edit','commit'=>$commit);
$this->config['link_edit_true'] = sprintf($this->config['link_edit_true'],$id);
$this->html = parent::getAction($this->config,$option);
}
Tag : PHP

|
ประวัติการแก้ไข 2011-08-28 12:14:44 2011-08-28 12:15:08
|
 |
 |
 |
 |
Date :
2011-08-28 12:13:11 |
By :
bank1324 |
View :
720 |
Reply :
2 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ที่ดูก็ไม่เห็นมีอะไรยากนี่ครับ
|
 |
 |
 |
 |
Date :
2011-08-28 14:41:05 |
By :
mr.v |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
เทคนิคไล่โค้ด ก็คือ การอ่านโค้ดแล้วไล่ตามสสเตปโค้ดนั่นหละครับ
หากไม่เข้าใจโค้ด ก็ไม่เข้าใจงาน เราก็สานต่อไม่ได้
|
 |
 |
 |
 |
Date :
2011-08-28 16:17:35 |
By :
deawx |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 01
|