그누보드4용 최근글 페이징을 그누보드5에 사용하고 싶습니다.
본문
안녕하세요?
제가 초보다보니 직접 제작은 어려워서 그누보드4용이라도 수정해서 쓰고 싶은데
역시나 잘 안됩니다.
k찰스님 ajax 최신글 페이징인데요
그냥 기본으로 그누5에 적용해도 리스트는 나오는데 페이징은 나오지 않습니다.
이걸 어떻게 수정해야 할까요? $g4를 $g5로 바꿔도 잘 안됩니다.
db 테이블 이름 같은 것도 수정해야 할 부분이 있을까요?
너무 질문이 과한 것 같아 죄송합니다만 고수님들 혹시 어디를 수정해야 할지 아시면 도움좀 부탁드립니다.
바쁘실텐데 읽어주셔서 감사합니다.
latest.skin.php
<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
include_once $latest_skin_path."/include_lib.php";
$_SESSION["paging_latest_{$bo_table}"] = true;
?>
<!-- UI Object -->
<div class="section_ul paging_latest">
<form action="#" method="post">
<input type="hidden" name="page" value="1">
<input type="hidden" name="total_page" value="<?=ceil($board['bo_count_write']/$rows)?>">
<input type="hidden" name="rows" value="<?=$rows?>">
<input type="hidden" name="bo_table" value="<?=$bo_table?>">
<input type="hidden" name="path" value="<?=$latest_skin_path?>">
<input type="hidden" name="bbs_path" value="<?=$g5['bbs_path']?>">
<h2><?=$board['bo_subject']?></h2>
<ul class="latest_content">
<? for ($i=0; $i<count($list); $i++) {?>
<li>
<span class="bu">›</span>
<?
echo $list[$i]['icon_reply'] . " ";
echo "<a href='{$list[$i]['href']}'>";
if ($list[$i]['is_notice'])
echo "<font style='font-family:돋움; font-size:9pt; color:#2C88B9;'><strong>{$list[$i]['subject']}</strong></font>";
else
echo "<font style='font-family:돋움; font-size:9pt; color:#6A6A6A;'>{$list[$i]['subject']}</font>";
echo "</a>";
if ($list[$i]['comment_cnt'])
echo " <a href=\"{$list[$i]['comment_href']}\"><span style='font-family:돋움; font-size:8pt; color:#9A9A9A;'>{$list[$i]['comment_cnt']}</span></a>";
// if ($list[$i]['link']['count']) { echo "[{$list[$i]['link']['count']}]"; }
// if ($list[$i]['file']['count']) { echo "<{$list[$i]['file']['count']}>"; }
echo " " . $list[$i]['icon_new'];
echo " " . $list[$i]['icon_file'];
echo " " . $list[$i]['icon_link'];
echo " " . $list[$i]['icon_hot'];
echo " " . $list[$i]['icon_secret'];
?>
<span class="time"><?=$list[$i]['datetime2']?></span>
</li>
<? } ?>
<? if (count($list) == 0) { ?><li>게시물이 없습니다.</li><? } ?>
</ul>
<a href="#" class="more"><span>›</span>더보기</a>
<? if (ceil($board['bo_count_write']/$rows) >= 1) { ?>
<div id="news_atc_page" class="page">
<span class="num" style=""><em class="cur_page">1</em> / <span><?=ceil($board['bo_count_write']/$rows)?></span></span>
<a href="javascript:;" title="이전" class="pre" onclick="latest_paging(this,'pre')"><span class="blind">이전</span></a>
<a href="javascript:;" title="다음" class="next" onclick="latest_paging(this,'next')"><span class="blind">다음</span></a>
</div>
<? } ?>
</form>
</div>
<!-- //UI Object -->
include_lib.php
<style>
/* UI Object */
.section_ul{position:relative;border:1px solid #ddd;background:#fff;font-size:12px;font-family:Tahoma, Geneva, sans-serif;line-height:normal;*zoom:1;padding-bottom:15px}
.section_ul a{color:#666;text-decoration:none}
.section_ul a:hover,
.section_ul a:active,
.section_ul a:focus{text-decoration:underline}
.section_ul em{font-style:normal}
.section_ul h2{margin:0;padding:10px 0 8px 13px;border-bottom:1px solid #ddd;font-size:12px;color:#333}
.section_ul h2 em{color:#cf3292}
.section_ul ul{margin:13px;padding:0;list-style:none}
.section_ul li{position:relative;margin:0 0 10px 0}
.section_ul li:after{display:block;clear:both;content:""}
.section_ul li .bu{float:left;margin:0 4px 0 0;color:#999}
.section_ul li a{float:left}
.section_ul li .time{float:right;clear:right;font-size:11px;color:#a8a8a8;white-space:nowrap}
.section_ul .more{position:absolute;top:10px;right:13px;font:11px Dotum, 돋움;text-decoration:none !important}
.section_ul .more span{margin:0 2px 0 0;font-size:16px;font-weight:bold;color:#d76ea9;vertical-align:middle}
.blind,legend{display:block;overflow:hidden;position:absolute;top:-1000em;left:0}
.page{font-size:.95em !important;line-height:1em !important}
.page a,.page span{display:-moz-inline-block;display:-moz-inline-box;display:inline-block;position:relative;margin-left:-5px;padding:3px;vertical-align:top}
.page a:hover{text-decoration:none}
.page a{overflow:hidden;z-index:1;height:14px}
.page .pre{padding-right:0}
.page .next{padding-left:0}
.page .num,.page .num span{margin-left:0;padding:0}
.page .num{margin-top:4px;margin-right:5px;*margin-right:0;font-size:.9em;font-family:tahoma,sans-serif;color:#b3b7bc;letter-spacing:-1px}
.page .num span{font-weight:bold}
.page .num em{font-weight:bold;color:#848689}
.page{position:absolute;top:160px;right:10px;*right:15px;_right:14px}
.page a{width:19px;background-image:url(http://static.naver.net/www/sp_main20120925v2.png)}
.page .pre{background-position:-317px -117px}
.page .next{background-position:-338px -117px}
/* //UI Object */
</style>
<script>
function latest_paging(t,flag)
{
var frm = $(t).parents('form');
var page = $("[name='page']",frm).val();
var total_page = $("[name='total_page']",frm).val();
if(flag == "pre")
{
if(page==1) return;
page--;
$("[name='page']",frm).val(page);
}else
{
if(page==total_page) return;
page++;
$("[name='page']",frm).val(page);
}
$(".cur_page",frm).html(page);
$.ajax({
type: 'post',
url: "<?=$latest_skin_path?>/get_list_content.php",
data: frm.serialize(),
success: function(xhr)
{
console.log('111')
$(".latest_content",frm).html(xhr);
}
});
}
</script>
get_list_content.php
<?
include "_common.php";
// 페이징 허용한 게시판인가
if(!$_SESSION["paging_latest_{$_POST['bo_table']}"]) { exit; }
$latest_skin_path = $_POST['path'];
$bo_table = $_POST['bo_table'];
$rows = $_POST['rows'];
$g5['bbs_path'] = $_POST['bbs_path'];
$limit = (($page - 1) * $rows);
$list = array();
$sql = " select * from $g5[board_table] where bo_table = '$bo_table'";
$board = sql_fetch($sql);
$tmp_write_table = $g5['write_prefix'] . $bo_table; // 게시판 테이블 전체이름
$sql = " select * from $tmp_write_table where wr_is_comment = 0 order by wr_num limit $limit, $rows ";
$result = sql_query($sql);
for ($i=0; $row = sql_fetch_array($result); $i++)
$list[$i] = get_list($row, $board, $latest_skin_path, $subject_len);
?>
<? for ($i=0; $i<count($list); $i++) {?>
<li>
<span class="bu">›</span>
<?
echo $list[$i]['icon_reply'] . " ";
echo "<a href='{$list[$i]['href']}'>";
if ($list[$i]['is_notice'])
echo "<font style='font-family:돋움; font-size:9pt; color:#2C88B9;'><strong>{$list[$i]['subject']}</strong></font>";
else
echo "<font style='font-family:돋움; font-size:9pt; color:#6A6A6A;'>{$list[$i]['subject']}</font>";
echo "</a>";
if ($list[$i]['comment_cnt'])
echo " <a href=\"{$list[$i]['comment_href']}\"><span style='font-family:돋움; font-size:8pt; color:#9A9A9A;'>{$list[$i]['comment_cnt']}</span></a>";
// if ($list[$i]['link']['count']) { echo "[{$list[$i]['link']['count']}]"; }
// if ($list[$i]['file']['count']) { echo "<{$list[$i]['file']['count']}>"; }
echo " " . $list[$i]['icon_new'];
echo " " . $list[$i]['icon_file'];
echo " " . $list[$i]['icon_link'];
echo " " . $list[$i]['icon_hot'];
echo " " . $list[$i]['icon_secret'];
?>
<span class="time"><?=$list[$i]['datetime2']?></span>
</li>
<? } ?>
_common.php
<?
$g5_path = "../../.."; // common.php 의 상대 경로
include_once("$g5_path/common.php");
?>
답변을 작성하시기 전에 로그인 해주세요.