미채택 완료

상대경로문제로 도움요청드립니다.

2015-10-12 (월) 02:43:27 3,579

http://sir.co.kr/g4_skin/148982 

시누이님 스킨을 응용해서 infinitescroll부분을 적용해보려고합니다.

그런데 추가로 생성되는 이미지나 링크가 모두 root로 링크가 걸려버리네요..;;

현재 구성은 apmsetup으로 개인 서버에 제작하는 사이트마다 폴더를 만들어서 진행하는데 다른건 다 문제가없는데 infinitescroll로 추가되는부분이 메인폴더를 기준으로 생성되네요.

그렇다보니 링크도 안되고 이미지썸네일도 안만들어지는데 해결방법이 있을까요?

제작중인 주소 http://www.d2bweb.co.kr/intoex

list.skin.php

Copy
<?if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가  // 선택옵션으로 인해 셀합치기가 가변적으로 변함//$colspan = 5; //if ($is_category) $colspan++;//if ($is_checkbox) $colspan++;//if ($is_good) $colspan++;//if ($is_nogood) $colspan++; // 제목이 두줄로 표시되는 경우 이 코드를 사용해 보세요.// <nobr style='display:block; overflow:hidden; width:000px;'>제목</nobr> include_once("$board_skin_path/thumb.lib.php");?> <style>#board_list {	font-family:'Malgun Gothic', '맑은고딕', sans-serif;	font-size:13px;	color:#555;	font-weight:400;	overflow:hidden;} /* SEARCH */#board_search {	float:right;	width:220px;	margin:0 auto;	padding:0;	background:url('<?=$board_skin_path?>/img/search_bg.png') 0 50% no-repeat;	text-align:center;	overflow:hidden;}#board_search input.stx {	float:left;	width:180px;	height:32px;	font-family:'Malgun Gothic', '맑은고딕', sans-serif;	font-size:11px;	color:#555;	line-height:32px;	padding:0 5px 0 5px;	border:none;	background:none;}#board_search input.search_btn {	float:right;	border:none;	cursor:pointer;	overflow:hidden;} /* CATEGORY */#board_list .category {	clear:both;	margin:10px 0 0 0;	padding:0;	list-style:none;	text-align:center;	overflow:hidden;}#board_list .category li {	width:14.3%;	display:inline-block;}#board_list .category li.all {	width:14.2%;}#board_list .category li:first-child a {	border-left:1px solid #ddd;}#board_list .category li a {	font-family:'Malgun Gothic', '맑은고딕', sans-serif;	font-size:15px;	color:#333;	line-height:30px;	letter-spacing:0;	word-spacing:0;	margin:0 auto;	padding:0;	background:#fff;	border:1px solid #ddd;	border-left:0;	text-align:center;	text-decoration:none;	display:block;	-webkit-transition: all 0.5s ease;    -moz-transition: all 0.5s ease;    -o-transition: all 0.5s ease;    transition: all 0.5s ease;	cursor:pointer;}#board_list .category li a:hover,#board_list .category li a.active {	color:#fff;	background:#333;	border:1px solid #333;	border-left:1px solid #555;} /* BOARD PAGER */#board_list .board_page {	clear:both;	margin:30px 0 0 0;	padding:0;	text-align:center;	overflow:hidden;}#board_list .page_wrap {	margin:0 10px 0 10px;	display:inline-block;}#board_list .board_page a.prev {	width:25px;	height:25px;	padding:0;	background:#fff url('<?=$board_skin_path?>/img/page_prev.gif') no-repeat;	border:1px solid #ddd;	display:inline-block;	vertical-align:bottom;}#board_list .board_page a.next {	width:25px;	height:25px;	padding:0;	background:#fff url('<?=$board_skin_path?>/img/page_next.gif') no-repeat;	border:1px solid #ddd;	display:inline-block;	vertical-align:bottom;}#board_list .board_page a.first {	width:25px;	height:25px;	padding:0;	background:#fff url('<?=$board_skin_path?>/img/page_first.gif') no-repeat;	border:1px solid #ddd;	display:inline-block;	vertical-align:bottom;}#board_list .board_page a.end {	width:25px;	height:25px;	padding:0;	background:#fff url('<?=$board_skin_path?>/img/page_end.gif') no-repeat;	border:1px solid #ddd;	display:inline-block;	vertical-align:bottom;}#board_list .board_page a {	width:25px;	font-family:'Malgun Gothic', '맑은고딕', sans-serif;	font-size:13px;	color:#777;	font-weight:bold;	margin:0 1px 0 1px;	padding:0;	line-height:25px;	text-align:center;	background:#fff;	border:1px solid #ddd;	text-decoration:none;	display:inline-block;}#board_list .board_page a:hover {	color:#333;	border:1px solid #333;}#board_list .board_page a.active {	color:#fff;	background:#333;	border:1px solid #333;} /* BOARD BUTTON */#board_list .board_button { clear:both; margin:30px 0 0 0; } #board_list .no_item {	clear:both;	font-family:'Malgun Gothic', '맑은고딕', sans-serif;	font-size:13px;	color:#999;	line-height:250px;	text-align:center;	overflow:hidden;} #exhibition {	clear:both;	overflow:hidden;}#exhibition .item_list {	position:relative;	float:left;	width:<?=$imgWidth?>px;	margin:20px 10px 0 10px;	overflow:hidden;}#exhibition .new_icon {	position:absolute;	width:50px;	height:50px;	left:0;	top:0;	background:url('<?=$board_skin_path?>/img/new_icon.png') no-repeat;	display:block;	z-index:9;}#exhibition .explain {	position:absolute;	bottom:0;	width:100%;	height:30px;	padding:10px 0 10px 0;	text-align:center;}#exhibition .subject {	font-family:'Malgun Gothic', '맑은고딕', sans-serif;	font-size:20px;	color:#fff;	margin:0 auto;	padding:0;	text-decoration:none;	display:inline-block;}#exhibition .sub_content {	font-family:'Malgun Gothic', '맑은고딕', sans-serif;	font-size:13px;	color:#777;	margin:0 10px 0 10px;	padding:0;	text-overflow:ellipsis;	white-space:nowrap;	word-wrap:normal;	overflow:hidden;}</style> <script type="text/javascript" src="<?=$board_skin_path?>/resource/jquery.masonry.min.js"></script><script type="text/javascript" src="<?=$board_skin_path?>/resource/jquery.infinitescroll.min.js"></script> <div id="board_list"> <!-- 게시판 목록 시작 --> 	<!-- 분류 -->	<div id="category_wrap">		<form name="fcategory" method="get" style="margin:0px;">			<? if ($is_category) { ?> 				<ul class="category"> 				<? 					$arr = explode("|", $board[bo_category_list]); 										$str = '<li class="all"><a href="'.$g4[bbs_path].'/board.php?bo_table='.$bo_table.'"'; 					if($sca == '') $str .= ' class="active"'; 					$str .= '>All</a></li>';  					for ($i=0; $i<count($arr); $i++) { 						$category = trim($arr[$i]); 						if($category=='') continue; 						$str .= '<li><a href="'.$g4[bbs_path].'/board.php?bo_table='.$bo_table.'&amp;sca='.urldecode($category).'"'; 							if($sca == $category) $str .= ' class="active"'; 							$str .= '>'.$category.'</a></li>'; 					} 					echo $str;				?> 				</ul>			<? } ?>		</form>	</div>     <!-- 제목 -->    <form name="fboardlist" method="post">    <input type='hidden' name='bo_table' value='<?=$bo_table?>'>    <input type='hidden' name='sfl'  value='<?=$sfl?>'>    <input type='hidden' name='stx'  value='<?=$stx?>'>    <input type='hidden' name='spt'  value='<?=$spt?>'>    <input type='hidden' name='page' value='<?=$page?>'>    <input type='hidden' name='sw'   value=''> 	<div id="exhibition">	<? for ($i=0; $i<count($list); $i++) { 		$imgWidth = "300"; 		$HeightArray = array("250","300","460","550");		$rand = array_rand($HeightArray);		$imgHeight = $HeightArray[$rand];	?>		<div class="item_list<?=$st?>">			<a href='<?=$list[$i][href]?>'><? echo makeThumbs($g4[path]."/data/file/$bo_table", $list[$i][file][0][file], $imgWidth, $imgHeight, cut_str($list[$i][subject],20)) ?></a>						<div class="explain">				<? if ($is_checkbox) { ?><input type=checkbox name=chk_wr_id[] value="<?=$list[$i][wr_id]?>"><? } ?><a href='<?=$list[$i][href]?>' class="subject"><?=$list[$i][subject]?></a>			</div>		</div>	<? } ?>     <? if (count($list) == 0) { echo "<div class='no_item'>등록된 내용이 없습니다.</div>"; } ?>	</div>    </form> 	<nav id="page-nav">		<a href="<?=$board_skin_path?>/list.append.php?bo_table=<?=$bo_table?>&page=2"></a>	</nav> 	<!-- 페이지 -->	<?/*    <div class="board_page">        <? if ($prev_part_href) { echo "<a href='$prev_part_href'><img src='$board_skin_path/img/page_search_prev.gif' border='0' align=absmiddle title='이전검색'></a>"; } ?>        <?        // 기본으로 넘어오는 페이지를 아래와 같이 변환하여 이미지로도 출력할 수 있습니다.        //echo $write_pages;        $write_pages = str_replace("처음", "<img src='$board_skin_path/img/page_begin.gif' border='0' align='absmiddle' title='처음'>", $write_pages);        $write_pages = str_replace("이전", "<img src='$board_skin_path/img/page_prev.gif' border='0' align='absmiddle' title='이전'>", $write_pages);        $write_pages = str_replace("다음", "<img src='$board_skin_path/img/page_next.gif' border='0' align='absmiddle' title='다음'>", $write_pages);        $write_pages = str_replace("맨끝", "<img src='$board_skin_path/img/page_end.gif' border='0' align='absmiddle' title='맨끝'>", $write_pages);        //$write_pages = preg_replace("/<span>([0-9]*)<\/span>/", "$1", $write_pages);        $write_pages = preg_replace("/<b>([0-9]*)<\/b>/", "<b><span style=\"color:#4D6185; font-size:12px; text-decoration:underline;\">$1</span></b>", $write_pages);        ?>        <?=$write_pages?>        <? if ($next_part_href) { echo "<a href='$next_part_href'><img src='$board_skin_path/img/page_search_next.gif' border='0' align=absmiddle title='다음검색'></a>"; } ?>    </div>	*/?>		<!-- 버튼 -->    <div class="board_button">        <div style="float:left;">        <? if ($list_href) { ?>        <a href="<?=$list_href?>"><img src="<?=$board_skin_path?>/img/btn_list.gif" align="absmiddle" border='0'></a>        <? } ?>        <? if ($is_checkbox) { ?>        <a href="javascript:select_delete();"><img src="<?=$board_skin_path?>/img/btn_select_delete.gif" align="absmiddle" border='0'></a>        <a href="javascript:select_copy('copy');"><img src="<?=$board_skin_path?>/img/btn_select_copy.gif" align="absmiddle" border='0'></a>        <a href="javascript:select_copy('move');"><img src="<?=$board_skin_path?>/img/btn_select_move.gif" align="absmiddle" border='0'></a>        <? } ?>        </div>         <div style="float:right;">        <? if ($write_href) { ?><a id='view_link' href="<?=$write_href?>" data-fancybox-type='iframe'><img src="<?=$board_skin_path?>/img/btn_write.gif" border='0'></a><? } ?>        </div>    </div></div> <script language="javascript">$(document).ready(function(){	var $container = $('#exhibition');	$(function(){		$container.imagesLoaded( function(){			$container.masonry({				itemSelector : '.item_list',				columnWidth : 20,				isFitWidth: true,				isAnimated : false			});		}); 		$container.infinitescroll({			navSelector  : '#page-nav',    // selector for the paged navigation			nextSelector : '#page-nav a',  // selector for the NEXT link (to page 2)			itemSelector : '.item_list',     // selector for all items you'll retrieve			loading: {				finishedMsg: 'No more pages to load.',				img: '<?php echo $board_skin_path?>/img/loading.gif'			}		},		// trigger Masonry as a callback		function( newElements ) {			// hide new items while they are loading			var $newElems = $( newElements ).css({ opacity: 0 });			// ensure that images load before adding to masonry layout			$newElems.imagesLoaded(function(){				// show elems now they're ready				$newElems.animate({ opacity: 1 });				$container.masonry( 'appended', $newElems, true );			});		}		); 	});/*	$('#exhibition').isotope({		// options		itemSelector: '.item_list',		percentPosition: true,		masonry: {			columnWidth: '.item_list'	    }	}); 	$('#exhibition').infinitescroll({		navSelector  : '#page-nav',    // selector for the paged navigation		nextSelector : '#page-nav a',  // selector for the NEXT link (to page 2)		itemSelector : '.item_list',     // selector for all items you'll retrieve		loading: {			finishedMsg: 'No more pages to load.',			img: '<?=$board_skin_path?>/img/loading.gif'		}	});*/}); // 더보기function more_append() {	$.ajax({		type:"post"		,url:"<?=$board_skin_path?>/list.append.php"		,data:$("#fboardlist").serialize()		,success:function(msg){			if (msg.replace(/^\s+/,"") != "") {				$("#exhibition").append(msg);				$("#fboardlist #page").val( parseInt($("#fboardlist #page").val()) + 1 ); 			} else {				alert("목록이 더 이상 존재하지 않습니다.");			}							}		,error:function(msg){			alert(msg);		}	});}</script> <? if ($is_checkbox) { ?><script type="text/javascript">function all_checked(sw) {    var f = document.fboardlist;     for (var i=0; i<f.length; i++) {        if (f.elements[i].name == "chk_wr_id[]")            f.elements[i].checked = sw;    }} function check_confirm(str) {    var f = document.fboardlist;    var chk_count = 0;     for (var i=0; i<f.length; i++) {        if (f.elements[i].name == "chk_wr_id[]" && f.elements[i].checked)            chk_count++;    }     if (!chk_count) {        alert(str + "할 게시물을 하나 이상 선택하세요.");        return false;    }    return true;} // 선택한 게시물 삭제function select_delete() {    var f = document.fboardlist;     str = "삭제";    if (!check_confirm(str))        return;     if (!confirm("선택한 게시물을 정말 "+str+" 하시겠습니까?\n\n한번 "+str+"한 자료는 복구할 수 없습니다"))        return;     f.action = "./delete_all.php";    f.submit();} // 선택한 게시물 복사 및 이동function select_copy(sw) {    var f = document.fboardlist;     if (sw == "copy")        str = "복사";    else        str = "이동";                           if (!check_confirm(str))        return;     var sub_win = window.open("", "move", "left=50, top=50, width=500, height=550, scrollbars=1");     f.sw.value = sw;    f.target = "move";    f.action = "./move.php";    f.submit();}</script><? } ?><!-- 게시판 목록 끝 -->

추가생성용 list.append.php

Copy
<?include_once("./_common.php");include_once("$board_skin_path/thumb.lib.php"); $sop = strtolower($sop);if ($sop != "and" && $sop != "or")    $sop = "and"; // 분류 선택 또는 검색어가 있다면$stx = trim($stx);if ($sca || $stx){    $sql_search = get_sql_search($sca, $sfl, $stx, $sop);     // 가장 작은 번호를 얻어서 변수에 저장 (하단의 페이징에서 사용)    $sql = " select MIN(wr_num) as min_wr_num from $write_table ";    $row = sql_fetch($sql);    $min_spt = $row[min_wr_num];     if (!$spt) $spt = $min_spt;     $sql_search .= " and (wr_num between '".$spt."' and '".($spt + $config[cf_search_part])."') ";     // 원글만 얻는다. (코멘트의 내용도 검색하기 위함)    $sql = " select distinct wr_parent from $write_table where $sql_search ";    $result = sql_query($sql, false);    $total_count = @mysql_num_rows($result);}else{    $sql_search = "";     $total_count = $board[bo_count_write];} $total_page  = ceil($total_count / $board[bo_page_rows]);  // 전체 페이지 계산if (!$page) { $page = 1; } // 페이지가 없으면 첫 페이지 (1 페이지)$from_record = ($page - 1) * $board[bo_page_rows]; // 시작 열을 구함  // 정렬// 인덱스 필드가 아니면 정렬에 사용하지 않음//if (!$sst || ($sst && !(strstr($sst, 'wr_id') || strstr($sst, "wr_datetime")))) {if (!$sst){    if ($board[bo_sort_field])        $sst = $board[bo_sort_field];    else        $sst  = "wr_num, wr_reply";    $sod = "";}else {    // 게시물 리스트의 정렬 대상 필드가 아니라면 공백으로 (nasca 님 09.06.16)    // 리스트에서 다른 필드로 정렬을 하려면 아래의 코드에 해당 필드를 추가하세요.    // $sst = preg_match("/^(wr_subject|wr_datetime|wr_hit|wr_good|wr_nogood)$/i", $sst) ? $sst : "";    $sst = preg_match("/^(wr_datetime|wr_hit|wr_good|wr_nogood)$/i", $sst) ? $sst : "";} if ($sst)    $sql_order = " order by $sst $sod "; if ($sca || $stx){    $sql = " select distinct wr_parent from $write_table where $sql_search $sql_order limit $from_record, $board[bo_page_rows] ";}else{    $sql = " select * from $write_table where wr_is_comment = 0 $sql_order limit $from_record, $board[bo_page_rows] ";}$result = sql_query($sql, false); // 년도 2자리$today2 = $g4[time_ymd]; $list = array();$i = 0; if (!$sca && !$stx){    $arr_notice = explode("\n", trim($board[bo_notice]));    for ($k=0; $k<count($arr_notice); $k++)    {        if (trim($arr_notice[$k])=='') continue;         $row = sql_fetch(" select * from $write_table where wr_id = '$arr_notice[$k]' ");         if (!$row[wr_id]) continue;         $list[$i] = get_list($row, $board, $board_skin_path, $board[bo_subject_len]);        $list[$i][is_notice] = true;         $i++;    }} $k = 0; while ($row = sql_fetch_array($result)){    // 검색일 경우 wr_id만 얻었으므로 다시 한행을 얻는다    if ($sca || $stx)        $row = sql_fetch(" select * from $write_table where wr_id = '$row[wr_parent]' ");     $list[$i] = get_list($row, $board, $board_skin_path, $board[bo_subject_len]);    if (strstr($sfl, "subject"))        $list[$i][subject] = search_font($stx, $list[$i][subject]);    $list[$i][is_notice] = false;    //$list[$i][num] = number_format($total_count - ($page - 1) * $board[bo_page_rows] - $k);    $list[$i][num] = $total_count - ($page - 1) * $board[bo_page_rows] - $k;     $i++;    $k++;}  $nobr_begin = $nobr_end = "";if (preg_match("/gecko|firefox/i", $_SERVER['HTTP_USER_AGENT'])) {    $nobr_begin = "<nobr style='display:block; overflow:hidden;'>";    $nobr_end   = "</nobr>";} for ($i=0; $i<count($list); $i++) { 			$subject = $list[$i][subject]; 	$checkbox = "";	if ($is_checkbox)		$checkbox = "<input type=checkbox name=chk_wr_id[] value='{$list[$i][wr_id]}'>"; 	// 썸네일.	$imgWidth = "300"; 	$HeightArray = array("250","300","460","550");	$rand = array_rand($HeightArray);	$imgHeight = $HeightArray[$rand];?> 	<div class="item_list<?=$st?>">		<a href='<?=$list[$i][href]?>'><? echo makeThumbs($g4[path]."/data/file/$bo_table", $list[$i][file][0][file], $imgWidth, $imgHeight, cut_str($list[$i][subject],20)) ?></a>						<div class="explain">			<? if ($is_checkbox) { ?><input type=checkbox name=chk_wr_id[] value="<?=$list[$i][wr_id]?>"><? } ?><a href='<?=$list[$i][href]?>' class="subject"><?=$list[$i][subject]?></a>		</div>	</div> <? } ?>

도움 부탁드립니다.

답변 1개 / 댓글 1개

 $board_skin_path  값이 잘 나오는지 확인해보세요

답변에 대한 댓글 1개

$board_skin_path값은 문제없이 잘 나옵니다.
아마도 list.append.php에서 _common.php를 include시키면서 _common.php안에 g4_path위치를 그대로 사용하는게 문제같은데 g4_path경로를 변경하면 다음내용들이 안나오네요..ㅜㅜ
이것만 해결하면 진행하는데 별다른 문제가 없을것같은데 경로문제가 생길줄은..;;

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