CI 묻고 답하기

제목 [게시판]Controller 페이지에서 값 두개 넘기는 방법좀 알려주세요
카테고리 CI 2, 3
글쓴이 유능한개발자가되고싶어요 작성시각 2019/09/26 16:45:17
댓글 : 4 추천 : 0 스크랩 : 0 조회수 : 15483   RSS

[view] 페이지

<tbody id="refer_list">

<?php foreach($refer_list as $row) :?>

<tr>

<td><?php echo $row['NUM'];?></td>

<td><?php echo $row['TITLE'];?></td>

<td><?php echo $row['REGCODE'];?></td>

<td><?php echo $row['REGDATE'];?></td>

<td><?php echo $row['HIT'];?></td>

</tr>

<?php endforeach ?>

</tbody>

-----------------

<table class="table table-condensed" id="refer_read">

<?php foreach($refer_list as $row) :?>

<tr>

<td width="60" align="left">제목 : </td>

<td align="left"><?php echo $row['TITLE'];?></td>

</tr>

<tr>

<td width="60" align="left">내용 : </td>

<td align="left" height="600"><?php echo $row['CONT'];?></td>

</tr>

<?php endforeach ?>

이렇게 뷰페이지에서는 id를 각각 다르게 주고 컨트롤러에서 받아 쓸려고합니다

[controller 페이지]

    $referList = $this->Integration_model->getReferenceSearch();

    $referRead = $this->Integration_model->getReferenceSearch();

    $data['refer_list'] = $referList;

    $data['refer_read'] =$referRead;

이런식으로 데이터 값을 두개를 받아 넘길려고 하는데 어떻게 넘겨야하는지 궁금하네요 도와주세요 ㅠㅠ

 다음글 CI4 locale을 위한 Route 설정 관련. (3)
 이전글 stored procedure를 CI상에서 call해... (4)

댓글

배강민 / 2019/09/26 16:53:42 / 추천 1

http://www.ciboard.co.kr/user_guide/kr/general/views.html

$data 배열을 통째로 넘겨서 키값을 변수로 해서 $refer_list, $refer_read 를 각각 사용하면 됩니다.

유능한개발자가되고싶어요 / 2019/09/26 17:00:44 / 추천 0

컨트롤러  

  $referList = $this->Integration_model->getReferenceSearch();

    $referRead = $this->Integration_model->getReferenceSearch();

컨트롤러에서 이 두줄을 한줄로 만들고 싶은데 어떤식으로 해야하나요 무슨말인지 모르겠습니다.

배강민 / 2019/09/26 18:05:31 / 추천 1

$this->Integration_model->getReferenceSearch(); 이 똑같은걸 2번 실행해서 다른 변수에 넣는다는 건가요?

왜인지는 모르겠지만, 그렇다면

$referList = $this->Integration_model->getReferenceSearch();

$referRead = $referList;

유능한개발자가되고싶어요 / 2019/09/27 08:46:51 / 추천 0
감사합니다 ~!! 덕분에 도움 많이 됬어요 ㅎㅎㅎ