코멘트 출력에서

코멘트 출력에서

QA

코멘트 출력에서

본문

댓글에 멀티 첨부파일을 적용하였는데 

문제는 비밀글체크해도 첨부파일은 안되네요

비밀글일 때는 첨부파일도 비밀글 처리할 수 없을까요?

코드는 아래와 같습니다.

 

 

        <!-- 댓글 출력 -->
        <?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 } ?>
        <!-- } 첨부파일 끝 -->

<?php if (strstr($list[$i]['wr_option'], "secret")) { ?><img src="<?php echo $board_skin_url; ?>/img/icon_secret.gif" alt="비밀글"><?php } ?>

코드를 참조했습니다.
위 코드는 정상적으로 출력되는 것 같습니다.

아래 코드는 위 코드를 참조하여 만들었습니다.

<?php if (strstr($list[$i]['wr_option'], "secret")) { 
  echo ''; // 비밀글일때는 공백 처리
} else if($cnt && $list[$i]['content1'] !='비밀글 입니다.' || $cnt && get_session($ss_name)) { ?>

답변을 작성하시기 전에 로그인 해주세요.
전체 123,518 | RSS
QA 내용 검색

회원로그인

(주)에스아이알소프트 / 대표:홍석명 / (06211) 서울특별시 강남구 역삼동 707-34 한신인터밸리24 서관 1404호 / E-Mail: admin@sir.kr
사업자등록번호: 217-81-36347 / 통신판매업신고번호:2014-서울강남-02098호 / 개인정보보호책임자:김민섭(minsup@sir.kr)
© SIRSOFT