코멘트 출력에서
본문
댓글에 멀티 첨부파일을 적용하였는데
문제는 비밀글체크해도 첨부파일은 안되네요
비밀글일 때는 첨부파일도 비밀글 처리할 수 없을까요?
코드는 아래와 같습니다.
<!-- 댓글 출력 -->
<?php $file_comment = get_view($list[$i], $board, $board_skin_path);
$cnt = 0;
if ($file_comment['file']['count']) {
for ($k=0; $k<count($file_comment['file']); $k++) {
if (isset($file_comment['file'][$k]['source']) && $file_comment['file'][$k]['source'])
$cnt++;
}
}
?>
<div class="cmt_contents">
<p>
<?php if (strstr($list[$i]['wr_option'], "secret")) { ?><img src="<?php echo $board_skin_url; ?>/img/icon_secret.gif" alt="비밀글"><?php } ?>
<?php if($cnt && $list[$i]['content1']!='비밀글 입니다.' || get_session($ss_name)){
for ($k=0; $k<count($file_comment['file']); $k++) {
if (isset($file_comment['file'][$k]['source']) && $file_comment['file'][$k]['source'] && $file_comment['file'][$k]['view']) {
echo '<div class="responed_img" style="margin-bottom:20px">'.$file_comment['file'][$k]['view']."</div>";
}
}
}?>
</p>
<?php if($cnt && $list[$i]['content1']!='비밀글 입니다.' || $cnt && get_session($ss_name) ) { ?>
<!-- 첨부파일 시작 { -->
<section id="bo_v_file">
<ul>
<?php
// 가변 파일 !$file_comment['file'][$k]['view'] 이미지를 걸러내는 함수 일단 제거 함.
for ($k=0; $k<count($file_comment['file']); $k++) {
if (isset($file_comment['file'][$k]['source']) && $file_comment['file'][$k]['source']) {
?>
<li>
<i class="fa fa-download" aria-hidden="true"></i>
<a href="<?php echo $file_comment['file'][$k]['href']; ?>" class="view_file_download">
<strong><?php echo $file_comment['file'][$k]['source'] ?></strong>
</a>
<?php echo $file_comment['file'][$k]['content'] ?> (<?php echo $file_comment['file'][$k]['size'] ?>)
<span class="bo_v_file_cnt" style="position: unset"><?php echo $file_comment['file'][$k]['download'] ?>회 다운로드 | DATE : <?php echo $file_comment['file'][$k]['datetime'] ?></span>
</li>
<?php
}
}
?>
</ul>
</section>
<?php } ?>
<!-- } 첨부파일 끝 -->
답변 2
<?php if(!strstr($list[$i]['wr_option'], "secret") && ($cnt && $list[$i]['content1'] !='비밀글 입니다.' || $cnt && get_session($ss_name))) { ?>
<!-- 첨부파일 시작 { -->
<section id="bo_v_file">
<ul>
<?php
// 가변 파일 !$file_comment['file'][$k]['view'] 이미지를 걸러내는 함수 일단 제거 함.
for ($k=0; $k<count($file_comment['file']); $k++) {
if (isset($file_comment['file'][$k]['source']) && $file_comment['file'][$k]['source']) {
?>
<li>
<i class="fa fa-download" aria-hidden="true"></i>
<a href="<?php echo $file_comment['file'][$k]['href']; ?>" class="view_file_download">
<strong><?php echo $file_comment['file'][$k]['source'] ?></strong>
</a>
<?php echo $file_comment['file'][$k]['content'] ?> (<?php echo $file_comment['file'][$k]['size'] ?>)
<span class="bo_v_file_cnt" style="position: unset"><?php echo $file_comment['file'][$k]['download'] ?>회 다운로드 | DATE : <?php echo $file_comment['file'][$k]['datetime'] ?></span>
</li>
<?php
}
}
?>
</ul>
</section>
<?php } ?>
<!-- } 첨부파일 끝 -->
위에 비밀글 if문가 첨부파일 비밀글 if문 조건이 다르네요 똑같이 맞춰보세요