미채택 완료

제목 출력 문제 입니다..

2015-07-12 (일) 21:08:11 2,156

설치한 스킨은 

http://sir.co.kr/bbs/board.php?bo_table=g5_skin&wr_id=3873&page=0&posting=ok&sca=&sfl=&stx=&sst=&sod=&spt=0&page=0 

이건데요..

리스트에서 중간중간 제목 출력을 못하는것 같습니다..

제목없는 번호는 클릭하면 해당 게시물로 넘어는 가는데.

주소창 보니까 

계정/bbs/board.php?bo_table=table4&wr_id=4#c_151​ 

이런식으로 코멘트글로 넘어가더라구요..​

스샷화면첨부 합니다..

aecab20291dc51cd82654c530f79b8f0_1436702808_1937.jpg
 

위 스킨 파일 소스.. 

Copy
<?phpif (!defined('_GNUBOARD_')) exit;  // 인기글 추출// $cache_time 캐시 갱신시간function latest_popular($bo_table, $rows=10, $subject_len=40, $term='', $options=''){&nbsp; &nbsp; global $g5;  	switch($term){		case '일간': $term_time = date("Y-m-d H:i:s", G5_SERVER_TIME-3600*24); break;		case '주간': $term_time = date("Y-m-d H:i:s", G5_SERVER_TIME-3600*24*7); break;		case '월간': $term_time = date("Y-m-d H:i:s", G5_SERVER_TIME-3600*24*30); break;	}  &nbsp; &nbsp; &nbsp; &nbsp; $list = array();  &nbsp; &nbsp; &nbsp;if($bo_table){	//각 게시판 출력		$sql = " select * from {$g5['board_table']} where bo_table = '{$bo_table}' ";&nbsp; &nbsp; &nbsp; &nbsp; $board = sql_fetch($sql);&nbsp; &nbsp; &nbsp; &nbsp; $bo_subject = get_text($board['bo_subject']);  &nbsp; &nbsp; &nbsp; &nbsp; $tmp_write_table = $g5['write_prefix'] . $bo_table; // 게시판 테이블 전체이름		$sql_between = " wr_datetime between '$term_time' and '".G5_TIME_YMDHIS."' ";&nbsp; &nbsp; &nbsp; &nbsp; $sql = " select * from {$tmp_write_table} where wr_is_comment = 0 and {$sql_between} order by {$options} limit 0, {$rows} ";&nbsp; &nbsp; &nbsp; &nbsp; $result = sql_query($sql);&nbsp; &nbsp; &nbsp; &nbsp; for ($i=0; $row = sql_fetch_array($result); $i++) {&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $list[$i] = get_list($row, $board, $latest_skin_url, $subject_len);&nbsp; &nbsp; &nbsp; &nbsp; }&nbsp; &nbsp; }else{	//전체 게시판 출력  &nbsp; &nbsp; &nbsp; &nbsp;$sql_between = " a.bn_datetime between '$term_time' and '".G5_TIME_YMDHIS."' ";&nbsp; &nbsp; &nbsp; &nbsp;$sql_common = " from {$g5['board_new_table']} a, {$g5['board_table']} b where a.bo_table = b.bo_table and b.bo_use_search = 1 and a.wr_id = a.wr_parent and {$sql_between} ";	 &nbsp; $sql_order = " order by a.bn_datetime desc ";  &nbsp; &nbsp; &nbsp; &nbsp;$sql = " select a.*, count(b.bo_subject) as cnt {$sql_common} {$sql_order} limit 0, {$rows} ";&nbsp; &nbsp; &nbsp; &nbsp;$row = sql_fetch($sql);	 &nbsp;&nbsp;  &nbsp; &nbsp; &nbsp; &nbsp;if($row[cnt] > 0){		$sql = " select a.*, b.bo_subject {$sql_common} {$sql_order} limit 0, {$rows} ";	 &nbsp; &nbsp; &nbsp; $result = sql_query($sql);		 &nbsp; &nbsp; &nbsp; for ($i=0; $row = sql_fetch_array($result); $i++){			$tmp_write_table = $g5['write_prefix'].$row['bo_table'];			$bo_table = $row['bo_table'];				 if($i > 0)			 $sql2 .= " union ";			 $sql2 .= "(select '{$bo_table}' as bo_table, wr_id, wr_subject, wr_hit, wr_good from {$tmp_write_table} where wr_datetime between '{$term_time}' and '".G5_TIME_YMDHIS."') ";	 &nbsp; &nbsp; &nbsp; }			$sql2 .= " order by ".$options." limit 0, 10";			$result2 = sql_query($sql2);				 for ($i=0; $row2 = sql_fetch_array($result2); $i++){		 &nbsp; &nbsp;$list[$i]['href'] = G5_BBS_URL.'/board.php?bo_table='.$row2['bo_table'].'&amp;wr_id='.$row2['wr_id'];		 &nbsp; &nbsp;$list[$i]['subject'] = $row2['wr_subject'];		 }	 &nbsp; }  &nbsp; &nbsp; }  &nbsp; &nbsp; ob_start();?>  <style type=text/css>.lt_full {position:relative;float:left;padding-bottom:10px;width:100%;height:135px;border-bottom:1px solid #e9e9e9}.lt2 {position:relative;float:left;padding-bottom:10px;width:354px;}.lt2 ul {margin:0 0 0 0;padding:0;list-style:none}.lt2 li {padding:0}</style>  <div class="lt_full"><div class="lt2">&nbsp; &nbsp; <ul>&nbsp; &nbsp; <?php for ($i=0; $i<count($list); $i++) { &nbsp;?>&nbsp; &nbsp; &nbsp; &nbsp; <li>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <?php&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; echo "<a href=\"".$list[$i]['href']."\">";				echo "<img src='".G5_URL."/img/num_".($i+1).".gif'> ";&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; echo "".cut_str($list[$i]['subject'],30).""; // 제목 길이 조절  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if ($list[$i]['comment_cnt'])&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; echo $list[$i]['comment_cnt'];  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; echo "</a>";&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ?>&nbsp; &nbsp; &nbsp; &nbsp; </li>&nbsp; &nbsp; <?php		if (($i+1)%($rows/2)==0) echo "</ul></div><div class='lt2'><ul>";		}	?>&nbsp; &nbsp; <?php if (count($list) == 0) { //게시물이 없을 때 &nbsp;?>&nbsp; &nbsp; <li>게시물이 없습니다.</li>&nbsp; &nbsp; <?php } &nbsp;?>&nbsp; &nbsp; </ul></div></div>  <?	$content = ob_get_contents();&nbsp; &nbsp; ob_end_clean();  &nbsp; &nbsp; return $content;}?>    <style>.tab_list ul{position:relative;margin:0;padding:0;border-bottom:1px solid #ccc;font-family:Tahoma, Sans-serif;font-size:12px;list-style:none;*zoom:1}.tab_list ul:after{display:block;clear:both;content:""}.tab_list li{float:left;margin-bottom:-1px}.tab_list li a{float:left;position:relative;border:1px solid #eee;border-bottom-color:#ccc;background:#fafafa;color:#666;text-decoration:none}.tab_list li a span{display:inline-block;padding:6px 25px 6px 25px;letter-spacing:-1px;cursor:pointer}.tab_list li ul{display:none;position:absolute;top:40px;left:0;width:100%;margin:0;padding:0;border:0;list-style:none;*zoom:1}.tab_list li li{float:none;position:relative;margin:0 0 8px 1px;color:#999}.tab_list li li a{float:none;margin:0;padding:0;border:0 !important;background:transparent;font-weight:normal;color:#333 !important;letter-spacing:normal;}.tab_list.m1 .m1 a,.tab_list.m2 .m2 a,.tab_list.m3 .m3 a,.tab_list.m4 .m4 a,.tab_list.m5 .m5 a {margin-top:-1px;border:1px solid #ccc;border-bottom:1px solid #fff;background:transparent;color:#333}.tab_list.m1 .m1 a span,.tab_list.m2 .m2 a span,.tab_list.m3 .m3 a span,.tab_list.m4 .m4 a span,.tab_list.m5 .m5 a span{padding-top:7px;font-weight:bold}.tab_list.m1 .m1 ul,.tab_list.m2 .m2 ul,.tab_list.m3 .m3 ul,.tab_list.m4 .m4 ul,.tab_list.m5 .m5 ul{margin-top:-20px;display:block}</style>  <div style="height:110px" class="tab_list m1"><ul>    <li class="m1"><a href="#" jquery16408452460570924265=1><span>일간 조회수</span></a>&nbsp;<ul>&nbsp; <li><?php echo latest_popular($bo_table, 10, 40, '일간', 'wr_hit desc'); ?></li></ul></li>  <li class="m2"><a href="#" jquery16408452460570924265=2><span>일간 추천수</span></a>&nbsp;<ul>&nbsp; <li><?php echo latest_popular($bo_table, 10, 40, '일간', 'wr_good desc'); ?></li></ul></li>  <li class="m3"><a href="#" jquery16408452460570924265=3><span>주간 조회수</span></a>&nbsp;<ul>&nbsp; <li><?php echo latest_popular($bo_table, 10, 40, '주간', 'wr_hit desc'); ?></li></ul></li>  <li class="m4"><a href="#" jquery16408452460570924265=4><span>주간 추천수</span></a>&nbsp;<ul>&nbsp; <li><?php echo latest_popular($bo_table, 10, 40, '주간', 'wr_good desc'); ?></li></ul></li>    </ul></div>  <script type="text/javascript">jQuery(function($){	var tab = $('.tab_list');	tab.removeClass('js_off');	tab.css('height', tab.find('>ul>li>ul:visible').height()+40);	function onSelectTab(){		var t = $(this);		var myClass = t.parent('li').attr('class');		t.parents('.tab_list:first').attr('class', 'tab_list '+myClass);		tab.css('height', t.next('ul').height()+40);	}	tab.find('>ul>li>a').click(onSelectTab).focus(onSelectTab);});</script>
|

답변 1개 / 댓글 1개

그누보드의 경우 게시글, 코멘트를 한 테이블에 저장하고 wr_is_comment가 0이냐 1이냐에 따라서 게시글, 코멘트로 구분합니다.

제 생각에는 위에 제목이 뜨지 않는 게시물은 코멘트인 것 같구요...

(주소 뒤에 #c_151​ ​ 보니 코멘트가 맞네요.)

 

글을 DB에서 가져올 때 날리는 쿼리문의 where문에 wr_id_comment=0 이라는 구문을 추가해주시면

코멘트가 아닌 게시물만 뜨게 될겁니다^^

---추가---

위에 소스에 보면 wr_id_comment=0구문이 있긴한데.....

39라인을 다음과같이 수정해보세요.

&nbsp; &nbsp; &nbsp; &nbsp;$sql_common = " from {$g5['board_new_table']} a, {$g5['board_table']} b where a.bo_table = b.bo_table and b.bo_use_search = 1 and a.wr_id = a.wr_parent and a.wr_is_comment=0 and {$sql_between} ";​

 

 

 

58라인도....

$sql2 .= "(select '{$bo_table}' as bo_table, wr_id, wr_subject, wr_hit, wr_good from {$tmp_write_table} where wr_datetime between '{$term_time}' and '".G5_TIME_YMDHIS."') and wr_is_comment=0 ";​

답변에 대한 댓글 1개

kalcapt님 답변감사합니다.
알려주신 소스 그대로 적용해보았는데, 전부 게시물이 없습니다. 라고 나오네요..ㅜㅜ

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