채택완료

(그누커머스)댓글에 넣는 인터넷주소를 새창에서 뜨게 할 수 없을까요?

2015-12-29 (화) 16:38:59 3,553

댓글에 이미지주소나 웹페이지 주소를 적어 봤는데요, 클릭해보면 현재창에서 뜹니다.

소스보기를 해보면...

<a href="http://cfile25.uf.tistory.com/image/2250103B56595A200BAEF8" target="">http://cfile25.uf.tistory.com/image/2250103B56595A200BAEF8</a>

처럼 target 부분이 비어있는 상황이고요.

이 부분을 지정하는 소스가 있을법한 곳을 찾아봤는데요,

(gnucommerce/skin/board/default/view_comment.skin.php) 

뭔가 건드릴 수 있을 것 같은 부분이 나놨습니다.

<?php

    $cmt_amt = count($list);

    for ($i=0; $i<$cmt_amt; $i++) {

        $comment_id = $list[$i]['cm_id'];

        $cmt_depth = (int) $list[$i]['cm_parent'] > 0 ? 1 : 0; // 댓글단계

        $cmt_depth = $cmt_depth * 20;

        $comment = $list[$i]['content'];

        $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 이하 사이드뷰 겹침 문제 해결

     ?>


여기까지 왔는데, 어떻게 수정해야 할지 모르겠습니다.ㅠㅠ
한 수 가르쳐 주시면 감사하겠습니다.
(혹, 제가 헛다리 짚었다면 바로잡아 주세요.)

p.s. 댓글 입력란도 TinyMCE Advanced 같은 에디터를 연동시킬 수 있으면 근본적으로 문제가 해결될 것 같은데... 이건 제 능력 밖이네요.ㅠㅠ
|

답변 1개 / 댓글 1개

채택된 답변
+20 포인트

사용하시는 테마 functions.php 에 아래와 같이 코드를 넣습니다. 

둘중에 하나를 선택해서 넣으시면 됩니다.

 

1.

 

Copy
add_filter('gc_config_add', 'custom_set_gc_config'); function custom_set_gc_config($config){    $config['cf_link_target'] = '_blank';    return $config; }

2.

Copy
add_action('wp_footer', 'gc_board_footer_script', 35); function gc_board_footer_script(){    global $gcboard;     if( isset($gcboard->is_gc_page) && !empty($gcboard->is_gc_page) ){  //그누커머스 게시판페이지이면?><script type="text/javascript">/* <![CDATA[ */jQuery(document).ready(function($) {    $("#bo_v_con, #bo_vc p").on("click", "a", function(e){        var target = $(this).attr("target"),            href = $(this).attr("href"),            regex = /(\S*#\[[^\]]+\])|(\S*#\S+)/gi;         if( target != 'self' && href && !regex.test(href) ){            e.preventDefault();            window.open( href );    //새창으로 연다.        }    });});/* ]]> */</script><?php    }   //end if}

답변에 대한 댓글 1개

도움 주셔서 이번에도 불편한 점을 해결했네요.
감사합니다.

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