| 제목 | 공통적인 부분은 따로 빼서 만들고 싶습니다. | ||
|---|---|---|---|
| 글쓴이 | 정수리 | 작성시각 | 2016/08/05 13:34:36 | 
|  | |||
| 사이트를 만들고 있는 중입니다. 
 
function basic_info(){
					
			$this->gg_info();
			
---------------------------------------------------------------여기부터	
			$no =  $this->uri->segment(3);
				
			$gg_name = $this->uri->segment(4);
			$gg_pg = $this->uri->segment(5);
			
		
		if(empty($gg_pg)){
				
			$date['info'] = $this->Gigwan_m->gigwan_info($no);
		
		}else{
			
			$date['info'] = $this->Gigwan_m->gigwan_info2($no, $gg_pg); 
			
		}
			$date['gginfo'] = array('gg_no' => $no,  'gg_name' =>$gg_name);
			$this->load->view('gigwan/gg_info_v', $date);
--------------------------------------------------------------------------------------끝(공통인부분)
			
			$this->load->view('footer_v');
		}저 공통인 부분만 따로 function B로 만든 후 다른 부분에서 $this-B()를 통해 호출하여 쓸려고 하니 $date를 찾을수 없는다는 오류가 뜨는데 function B에 있는 $date를 호출하는 부분에서 사용할수 없나요? 
 | |||
| 다음글 | httpRequest.open 에러.. 좀 도와주세요 ... (3) | ||
| 이전글 | MVC 패턴 관련해서 간단한 질문하나만 드리겠습니다.. (3) | ||
| 
                                kaido
                                /
                                2016/08/05 14:00:47 /
                                추천
                                0
                             | 
| 
                                정수리
                                /
                                2016/08/05 14:30:55 /
                                추천
                                0
                             @kaido 답변 감사합니다; 제가 아직 많이 부족해서 그런지 답변의 내용을 이해를 못하겠네요 
function B(){
			$no =  $this->uri->segment(3);
				
			$gg_name = $this->uri->segment(4);
			$gg_pg = $this->uri->segment(5);
			
		
		if(empty($gg_pg)){
				
			$date['info'] = $this->Gigwan_m->gigwan_info($no);
		
		}else{
			
			$date['info'] = $this->Gigwan_m->gigwan_info2($no, $gg_pg); 
			
		}
			return $date['gginfo'] = array('gg_no' => $no,  'gg_name' =>$gg_name);
		}
function pact_info(){
			    
			$this->B();
                        $this->load->view('head',$date);
		}
어떤 해당 정보를 function b에 넘겨주라는 말씀이시죠?; 에러 funcion pact_info의 $date에서 오류가 발생합니다 
 
 | 
| 
                                kaido
                                /
                                2016/08/05 14:34:43 /
                                추천
                                0
                             
function basic_info(){
                     
            $this->gg_info();
             
---------------------------------------------------------------여기부터
            $no =  $this->uri->segment(3);
                 
            $gg_name = $this->uri->segment(4);
 
            $gg_pg = $this->uri->segment(5);
           $this->B($no, $gg_name, $gg_pg);
}
function B($no, $gg_name, $gg_pg){
....
}
 | 
| 
                                정수리
                                /
                                2016/08/05 14:47:54 /
                                추천
                                0
                             @kaido 
 답변감사합니다. 그래도 똑같은 오류로 pact_info에서 $date가 정의 되지 않았다는 오류가 발생하네요 function B에서 segment를 통해 정보를 가져오기에 굳이 basic_info에서 segment를 통해 값을 가져와 B로 안보내도 될듯하내요 | 
| 
                                kaido
                                /
                                2016/08/05 14:50:07 /
                                추천
                                0
                             아 -_- 리턴을 하셨으면 받아가셔야죠 
 $date = $this->B(); |