(그누커머스)댓글에 넣는 인터넷주소를 새창에서 뜨게 할 수 없을까요?
본문
댓글에 이미지주소나 웹페이지 주소를 적어 봤는데요, 클릭해보면 현재창에서 뜹니다.
소스보기를 해보면...
<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 이하 사이드뷰 겹침 문제 해결
?>
답변 1
사용하시는 테마 functions.php 에 아래와 같이 코드를 넣습니다.
둘중에 하나를 선택해서 넣으시면 됩니다.
1.
add_filter('gc_config_add', 'custom_set_gc_config');
function custom_set_gc_config($config){
$config['cf_link_target'] = '_blank';
return $config;
}
2.
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
}