리스트에 각 게시글의 확장필드 출력
본문
리스트에 각 게시글의 확장필드 출력시 list.skin.php에서
<?php
for ($i=0; $i<count($list); $i++) {
$ex4_filed = explode("|",$list[$i]['wr_4']);
$ext4_00 = $ex4_filed[0];
$ext4_01 = $ex4_filed[1];
$ext4_02 = $ex4_filed[2];
$ext4_03 = $ex4_filed[3];
$ext4_04 = $ex4_filed[4];
}
?>
출력할 부분에 <?=$list[$i][wr_4]?> 하면 모두 출력이 되는데
wr_4에 등록된 해당부분문 아래처럼 불러오면, 각 게시물의 wr_4에 저장되어있는 ext4_02,ext4_03,ext4_04를 못불러옵니다.
<?php echo $ext4_02; ?>-<?php echo $ext4_03; ?>-<?php echo $ext4_04; ?>
불러와도, 리스트의 맨 아래번호의 글에 해당하는 정보가 리스트 전체에 보여져요~
어떻게해야하나요?ㅠㅠ
답변 1
$ex4_filed = '';
$ext4_00 = '';
$ext4_01 = '';
$ext4_02 = '';
$ext4_03 = '';
$ext4_04 = '';
변수를 초기화 하고
$ex4_filed = explode("|",$list[$i]['wr_4']);
$ext4_00 = $ex4_filed[0];
$ext4_01 = $ex4_filed[1];
$ext4_02 = $ex4_filed[2];
$ext4_03 = $ex4_filed[3];
$ext4_04 = $ex4_filed[4];
해보세요