채택완료

코멘트에서요

2017-12-10 (일) 22:43:34 4,271

   아래가 코멘트 출력부분인데

 <?php
    $cmt_amt = count($list);
    for ($i=0; $i<$cmt_amt; $i++) {
        $comment_id = $list[$i]['wr_id'];
        $cmt_depth = strlen($list[$i]['wr_comment_reply']) * 50;
        $comment = $list[$i]['content'];
        /*
        if (strstr($list[$i]['wr_option'], "secret")) {
            $str = $str;
        }
        */
        $comment = preg_replace("/\[\<a\s.*href\=\"(http|https|ftp|mms)\:\/\/([^[:space:]]+)\.(mp3|wma|wmv|asf|asx|mpg|mpeg)\".*\<\/a\>\]/i", "<script>doc_write(obj_movie('$1://$2.$3'));</script>", $comment);
        $cmt_sv = $cmt_amt - $i + 1; // 댓글 헤더 z-index 재설정 ie8 이하 사이드뷰 겹침 문제 해결
     ?>

상단 소스중 빨간색부분이 코멘트출력내용부분입니다..

이부분을 회원에게는 보여주고 비회원에게는 로그인후 확인가능합니다. 라고 표현해주고 싶은데 이럴땐 어찌해야할지 소스부탁드립니다.

몇일전에 질문을 잘못올려서 답변주신분이 있는데 감사한데 못써먹엇네요 ㅠㅠ

|

답변 1개

채택된 답변
+20 포인트
2017-12-10 (일) 22:50:42
Copy
<?php
    $cmt_amt = count($list);
    for ($i=0; $i<$cmt_amt; $i++) {
        $comment_id = $list[$i]['wr_id'];
        $cmt_depth = strlen($list[$i]['wr_comment_reply']) * 50;

        if ($is_member)
            $comment = $list[$i]['content'];
        else 
            $comment="로그인 후 확인가능합니다";


        /*
        if (strstr($list[$i]['wr_option'], "secret")) {
            $str = $str;
        }
        */
        $comment = preg_replace("/\[\<a\s.*href\=\"(http|https|ftp|mms)\:\/\/([^[:space:]]+)\.(mp3|wma|wmv|asf|asx|mpg|mpeg)\".*\<\/a\>\]/i", "<script>doc_write(obj_movie('$1://$2.$3'));</script>", $comment);
        $cmt_sv = $cmt_amt - $i + 1; // 댓글 헤더 z-index 재설정 ie8 이하 사이드뷰 겹침 문제 해결
 ?>

이렇게 해보세요~

답변을 작성하려면 로그인이 필요합니다.