최신글의 링크 오류 문제

최신글의 링크 오류 문제

QA

최신글의 링크 오류 문제

본문

3025370613_1653460564.9707.png

 

위와 같이 최신글에 등록된 게시글의 링크가 오류가 나고 있습니다.

아래 최신글 소스에서 어떻게 수정하면 될까요?

 


<?php
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
include_once(G5_LIB_PATH.'/thumbnail.lib.php');
// add_stylesheet('css 구문', 출력순서); 숫자가 작을 수록 먼저 출력됨
add_stylesheet('<link rel="stylesheet" href="'.$latest_skin_url.'/style.css">', 0);
$thumb_width = 480;
$thumb_height = 360;
$list_count = (is_array($list) && $list) ? count($list) : 0;

/*
 * 유투브 주소에서 Video ID를 추출합니다. 
 */
if ( ! function_exists( 'get_video_id' ) )
{
    function get_video_id( $str )
    {
        if( substr( $str, 0, 4 ) == 'http' )
        {
            if( strpos( $str, 'youtu.be' ) )
            {
                return array_pop( explode( '/', $str ) );
            }
            else if( strpos( $str, '/embed/' ) )
            {
                return array_pop( explode( '/', $str ) );
            }
            else if( strpos( $str, '/v/' ) )
            {
                return array_pop( explode( '/', $str ) );
            }
            else
            {
                $params = explode( '&', array_shift( explode( '#', array_pop( explode( '?', $str ) ) ) ) );
                foreach( $params as $data )
                {
                    $arr = explode( '=', $data );
                    if( $arr[ 0 ] == 'v' )
                    {
                        return $arr[ 1 ];
                    }
                }
            }
        }
        else
        {
            return $str;
        }
 
        return '';
    }
}
 
/*
 * 썸네일 주소를 가져옵니다. 기본값은 default 입니다.
 */
if ( ! function_exists( 'get_yt_thumb' ) )
{
    function get_yt_thumb( $url_or_id, $type )
    {
        switch( $type )
        {
            case '0' :
                return '//img.youtube.com/vi/'.get_video_id( $url_or_id ).'/0.jpg';
                break;
            case '1' :
                return '//img.youtube.com/vi/'.get_video_id( $url_or_id ).'/1.jpg';
                break;
            case '2' :
                return '//img.youtube.com/vi/'.get_video_id( $url_or_id ).'/2.jpg';
                break;
            case '3' :
                return '//img.youtube.com/vi/'.get_video_id( $url_or_id ).'/3.jpg';
                break;
            case 'hq' :
                return '//img.youtube.com/vi/'.get_video_id( $url_or_id ).'/hqdefault.jpg';
                break;
            case 'mq' :
                return '//img.youtube.com/vi/'.get_video_id( $url_or_id ).'/mqdefault.jpg';
                break;
            case 'sd' :
                return '//img.youtube.com/vi/'.get_video_id( $url_or_id ).'/sddefault.jpg';
                break;
            case 'maxres' :
                return '//img.youtube.com/vi/'.get_video_id( $url_or_id ).'/maxresdefault.jpg';
                break;
            default :
                return '//img.youtube.com/vi/'.get_video_id( $url_or_id ).'/default.jpg';
        }
    }
}

?>
<div class="pic_lt">
    <ul>
       
       <?php
            for ($i=0; $i<$list_count; $i++) {
            $thumb = get_list_thumbnail($bo_table, $list[$i]['wr_id'], $thumb_width, $thumb_height, false, true);
            if($thumb['src']) {
                //$img = $thumb['src'];
                $img_content = '<img src="'.$thumb['src'].'" alt="'.$thumb['alt'].'" >';
            } else {
                //$img = G5_IMG_URL.'/no_img.png';
                //$thumb['alt'] = '이미지가 없습니다.';
                $v = "";
                $daumpot_limit = "";
                $mov_link = "";
                $img_content = "";
                $mov_link = $list[$i]['wr_10'];
                $youtube_url = parse_url($mov_link);
                parse_str($youtube_url['query']);
                if($v){
                    $img_content = '<img src="'.get_yt_thumb( 'http://youtu.be/'.$v, 'hq' ).'"class="youtube_thum"'.'">';
                }
            }
        ?>
       
       
       
        <li class="gallery_li">
            <a href="<?php echo $list[$i]['href'] ?>" class="lt_img"><?php echo run_replace('thumb_image_tag', $img_content, $thumb); ?></a>
            
            <div class="text">
                <div class="board_title after">
                    <h2 class="lat_title"><?php echo $bo_subject ?></h2>
                    <a href="<?php echo get_pretty_url($bo_table); ?>" class="lt_more"><span class="sound_only"><?php echo $bo_subject ?></span>+</a>
                </div>
                
                <a href="<?php echo $list[$i]['href'] ?>"><?php echo $list[$i]['subject']; ?></a>
                
                <div class="lt_info">
                    <span class="lt_date"><?php echo $list[$i]['datetime2'] ?></span>
                </div>
            </div>
            
        </li>
        <?php }  ?>
        <?php if ($list_count == 0) { //게시물이 없을 때  ?>
        <li class="empty_li">게시물이 없습니다.</li>
        <?php }  ?>
    </ul>
    
</div>
 

이 질문에 댓글 쓰기 :

답변 2

lib/common.lib.php를 보면

    $list['href'] = get_pretty_url($board['bo_table'], $list['wr_id'], $qstr);
    $list['comment_href'] = $list['href'];

 

결국 설정문제인 듯합니다.

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

회원로그인

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