5.4.2 버전 사용중인데요...최신글에 글번호 나오게 하고싶은데...
5.2 버전에서 아래와같이 하면 최신글에 글번호가 나왔는데...
<?php
$write_table = $g5['write_prefix'].$bo_table;
$sql = " select distinct wr_parent from $write_table ";
$result = sql_query($sql);
$total_count = mysql_num_rows($result);
for ($i=0; $i<count($list); $i++) {
$list_num = $total_count;
$list[$i]['num'] = $list_num - $k;
$k++;
?>
<tr><td height="35" style="border-bottom:1px solid #ccc; padding:0 5px 0;">
<?
if ($list[$i]['icon_reply'])
echo " ".$list[$i]['icon_reply']." ";
echo "<a href=\"" . $list[$i]['href'] . "\">";
if ($list[$i]['is_notice']) {
echo "<strong>" . $list[$i]['subject'] . "</strong>";
} else {
echo $list[$i]['num'];
echo " ". $list[$i]['subject'];
}
5.4 버젼은
<div class="lat">
<h2 class="lat_title"><a href="<?php echo get_pretty_url($bo_table); ?>"><?php echo $bo_subject ?></a></h2>
<ul>
<?php for ($i=0; $i<$list_count; $i++) { ?>
<li class="basic_li">
<?php
if ($list[$i]['icon_secret']) echo "<i class=\"fa fa-lock\" aria-hidden=\"true\"></i><span class=\"sound_only\">비밀글</span> ";
echo "<a href=\"".$list[$i]['href']."\"> ";
if ($list[$i]['is_notice'])
echo "<strong>".$list[$i]['subject']."</strong>";
else
echo $list[$i]['num'];
echo $list[$i]['subject'];
echo "</a>";
if ($list[$i]['icon_hot']) echo "<span class=\"hot_icon\"><i class=\"fa fa-heart\" aria-hidden=\"true\"></i><span class=\"sound_only\">인기글</span></span>";
if ($list[$i]['icon_new']) echo "<span class=\"new_icon\">N<span class=\"sound_only\">새글</span></span>";
// if ($list[$i]['link']['count']) { echo "[{$list[$i]['link']['count']}]"; }
// if ($list[$i]['file']['count']) { echo "<{$list[$i]['file']['count']}>"; }
echo $list[$i]['num'];
이렇게 해도 번호가 나오지않아요....
최신글에 글번호 나오게 하면 어떡해해야하는지 알려주시면 감사하겠습니다...
답변 5개 / 댓글 7개
쓰고 계신 5.2를 5.4로 변경 하시는거 아닌가요?
이렇게 저렇게라고 말씀 하시면 무슨 말인지 알 수가 없습니다.
작업하신 소스를 올려 주세요.
글 번호라는게 별거 없습니다.
어차피 최신글이라 전체 글 수에서 하나씩 빼서 보여주는겁니다.
5.2에서 되는 소스를 그대로 적용한건데 안된다고 하시니...
그럼 이걸 쓰셔야 할겁니다.
<?php
$write_table = $g5['write_prefix'].$bo_table;
$sql = " select distinct wr_parent from $write_table ";
$result = sql_query($sql);
$total_count = mysql_num_rows($result);
for ($i=0; $i<$list_count; $i++) {
$list_num = $total_count;
$list[$i]['num'] = $list_num - $k;
$k++;
?>
$list_num = $total_count;
$list[$i]['num'] = $list_num - $k;
$k++;
빠져 있네요.
<?php for ($i=0; $i<$list_count; $i++) { ?>
에 넣으세요.
for ($i=0; $i<count($list); $i++) {
$list_num = $total_count;
$list[$i]['num'] = $list_num - $k;
$k++;
?>
답변에 대한 댓글 5개
위 아래 소스 차이가 있어 그대로 쓰시면 문제가 될거 같습니다.
그래서 아래 소스 복사해서 넣어 주세요.
$total_count 대신에 for 문의 $list_count 적용 했습니다.
[code]
<?php for ($i=0; $i<$list_count; $i++) { ?> <--- 이거 대신
--- 이 아래꺼 넣으세요. ---
<?php
for ($i=0; $i<$list_count; $i++) {
$list_num = $list_count;
$list[$i]['num'] = $list_num - $k;
$k++;
?>
[/code]
답변을 작성하려면 로그인이 필요합니다.
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
// add_stylesheet('css 구문', 출력순서); 숫자가 작을 수록 먼저 출력됨
add_stylesheet('<link rel="stylesheet" href="'.$latest_skin_url.'/style.css">', 0);
$list_count = (is_array($list) && $list) ? count($list) : 0;
?>
<div class="lat">
<h2 class="lat_title"><a href="<?php echo get_pretty_url($bo_table); ?>"><?php echo $bo_subject ?></a></h2>
<ul>
<?php for ($i=0; $i<$list_count; $i++) { ?>
<li class="basic_li">
<?php
if ($list[$i]['icon_secret']) echo "<i class=\"fa fa-lock\" aria-hidden=\"true\"></i><span class=\"sound_only\">비밀글</span> ";
echo "<a href=\"".$list[$i]['href']."\"> ";
if ($list[$i]['is_notice'])
echo "<strong>".$list[$i]['subject']."</strong>";
else
echo " ". $list[$i]['subject'];
echo "</a>";
if ($list[$i]['icon_hot']) echo "<span class=\"hot_icon\"><i class=\"fa fa-heart\" aria-hidden=\"true\"></i><span class=\"sound_only\">인기글</span></span>";
if ($list[$i]['icon_new']) echo "<span class=\"new_icon\">N<span class=\"sound_only\">새글</span></span>";
// if ($list[$i]['link']['count']) { echo "[{$list[$i]['link']['count']}]"; }
// if ($list[$i]['file']['count']) { echo "<{$list[$i]['file']['count']}>"; }
echo $list[$i]['icon_reply']." ";
if ($list[$i]['icon_file']) echo " <i class=\"fa fa-download\" aria-hidden=\"true\"></i>" ;
if ($list[$i]['icon_link']) echo " <i class=\"fa fa-link\" aria-hidden=\"true\"></i>" ;
if ($list[$i]['comment_cnt']) echo "
<span class=\"lt_cmt\"><span class=\"sound_only\">댓글</span>".$list[$i]['comment_cnt']."</span>";
?>
<div class="lt_info">
<span class="lt_nick"><?php// echo $list[$i]['name'] ?></span>
<span class="lt_date"><?php// echo $list[$i]['datetime2'] ?></span>
</div>
</li>
<?php } ?>
<?php if ($list_count == 0) { //게시물이 없을 때 ?>
<li class="empty_li">게시물이 없습니다.</li>
<?php } ?>
</ul>
<a href="<?php echo get_pretty_url($bo_table); ?>" class="lt_more"><span class="sound_only"><?php echo $bo_subject ?></span>더보기</a>
</div>
이게 5.4 최신글인데요
<?php for ($i=0; $i<$list_count; $i++) { ?>
이부분을 알려주신데로
<?php
$write_table = $g5['write_prefix'].$bo_table;
$sql = " select distinct wr_parent from $write_table ";
$result = sql_query($sql);
$total_count = mysql_num_rows($result);
for ($i=0; $i<$list_count; $i++) {
$list_num = $total_count;
$list[$i]['num'] = $list_num - $k;
$k++;
?>
이렇게 했는데 최신글이 안떠요...