메인화면의 최근게시물 댓글 관련 정보
메인화면의 최근게시물 댓글 관련
본문
탑빌더로 홈피 만들어 운영하고 있습니다.
Top_gallery 스킨을 사용하여 사진 관련 게시판이 있고 이를 메인화면에서 게시물추출해 쉽게 접근하도록 하고 있습니다.
게시물 추출에서 그림과 같이 제목 뒤에 댓글 갯수가 나오면 더 좋겠다는 생각을 많이 해왔습니다.
소스 수정해 시도해봤지만 제 실력으로는 잘 안됩니다.
여러 선배 고수님들께 도움 요청합니다.
사용중인 최근 게시물 latest.skin.php 내용입니다.
<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
include_once("$latest_skin_path/skin.lib.php");
$img_width = 131; // 이미지 가로 사이즈
$img_height = 100; // 이미지 세로 사이즈
$mod = 3; // 한줄 출력개수
$data_path = $g4[path]."/data/file/$bo_table";
$thumb_path = $data_path.'/latest_thumb';
@mkdir($thumb_path, 0707);
@chmod($thumb_path, 0707);
?>
<style type="text/css">
.latestList {position:relative; margin-bottom:10px; padding-bottom:2px; border-bottom:1px solid #ddd; font-size:12px; }
.latestList * {margin:0; padding:0; border:none;}
.latestList h2 {margin-bottom:3px; padding:4px; font-size:12px;}
.latestList h2 a {text-decoration:none; color:#222;}
.latestList li {list-style:none; line-height:160%; font-size:12px;}
.latestList ul.thumb li {position:relative; display:inline; float:left; margin-left:10px;}
.latestList ul.thumb li.first {margin-left:7;}
.latestList ul.thumb li img {vertical-align:top; width:131px;}
.latestList ul.thumb li span {position:absolute; left:0; bottom:-23; width:<?=$img_width?>px; height:20px; overflow:hidden; text-align:center; font-size:12px; color:#4C4C4C; background:;}
.latestList .btnPage {position:absolute; top:6px; right:0;}
.latestList .btnPage li {display:inline; float:left;}
.latestList.h2bg {border-bottom:none;}
.latestList.h2bg ul.btnPage {right:10px;}
.latestList.h2bg h2 {background:#ebebeb; -moz-border-radius: 5px;}
.latestList.h2bg h2 a {color:#000;}
</style>
<div class="latestList h2bg" >
<h2><img src="/gnu4/skin/latest/kplayer_latest_skin/img/icon.gif"> <a href="<?=$g4[bbs_path]?>/board.php?bo_table=<?=$bo_table?>"><?=$board[bo_subject]?></a></h2>
<ul class="btnPage">
<li><a href='<?=$g4[bbs_path]?>/board.php?bo_table=<?=$bo_table?>'><img src="<?=$latest_skin_path?>/img/box01_more.gif" width="47" height="13" border="0" alt="전체보기" title="전체보기" /></a></li>
</ul>
<ul class="thumb">
<?
for ($i=0; $i<count($list); $i++) {
?>
<li <?if($i==0){echo "class='first'";}?>>
<?
if($list[$i][file][0][view]){
$src = $list[$i][file][0][path]."/".$list[$i][file][0][file];
$get_img = getimagesize($src); // 파일정보를 가져옴
// 관리자가 이미지 사이즈를 바꾸었을때를 대비하여 리사이징 크기를 이름에 포함과 이미지 재 첨부시 바뀜
$img_step1 = explode("_",$list[$i][file][0][file]);
$img_step2 = explode(".",$img_step1[1]);
$new_imgname = $img_step2[0];
$thumb_file_list = "{$thumb_path}/{$img_width}x{$img_height}_{$new_imgname}_{$list[$i][wr_id]}_list";
if(!file_exists($thumb_file_list)){
// gd lib 체크
$gd = gd_info();
$gdversion = substr(preg_replace("/[^0-9]/", "", $gd['GD Version']), 0, 2); // gd 버전이 2.0 이상인지 체크
if(!$gdversion){
$thumb_file_view = $src; // gd 2.0 이하면 강제적으로 줄임
}else{
if($img_width > $get_img[0] || $img_height > $get_img[1]){
$thumb_file_list = $src;
}else{
createThumb_list($img_width,$img_height,$src, $thumb_file_list, $get_img); // list 페이지 썸네일
}
}
}
$img = "<a href='{$list[$i]['href']}'><img src=\"$thumb_file_list\" border=\"0\" width=\"$img_width\" height=\"$img_height\"/><span>{$list[$i]['subject']}</span></a>";
}else{
// no 이미지를 비율적으로 만들어났음
$img = "<a href='{$list[$i]['href']}'><img src=\"$latest_skin_path/img/noimage.png\" border=\"0\" height=\"{$img_height}\" width=\"{$img_width}\"/><span>{$list[$i]['subject']}</span></a>";
}
echo $img;
?>
</li>
<?}?>
<? if (count($list) == 0) { ?><li>게시물이 없습니다.</li><? } ?>
</ul>
</div>
Top_gallery 스킨을 사용하여 사진 관련 게시판이 있고 이를 메인화면에서 게시물추출해 쉽게 접근하도록 하고 있습니다.
게시물 추출에서 그림과 같이 제목 뒤에 댓글 갯수가 나오면 더 좋겠다는 생각을 많이 해왔습니다.
소스 수정해 시도해봤지만 제 실력으로는 잘 안됩니다.
여러 선배 고수님들께 도움 요청합니다.
사용중인 최근 게시물 latest.skin.php 내용입니다.
<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
include_once("$latest_skin_path/skin.lib.php");
$img_width = 131; // 이미지 가로 사이즈
$img_height = 100; // 이미지 세로 사이즈
$mod = 3; // 한줄 출력개수
$data_path = $g4[path]."/data/file/$bo_table";
$thumb_path = $data_path.'/latest_thumb';
@mkdir($thumb_path, 0707);
@chmod($thumb_path, 0707);
?>
<style type="text/css">
.latestList {position:relative; margin-bottom:10px; padding-bottom:2px; border-bottom:1px solid #ddd; font-size:12px; }
.latestList * {margin:0; padding:0; border:none;}
.latestList h2 {margin-bottom:3px; padding:4px; font-size:12px;}
.latestList h2 a {text-decoration:none; color:#222;}
.latestList li {list-style:none; line-height:160%; font-size:12px;}
.latestList ul.thumb li {position:relative; display:inline; float:left; margin-left:10px;}
.latestList ul.thumb li.first {margin-left:7;}
.latestList ul.thumb li img {vertical-align:top; width:131px;}
.latestList ul.thumb li span {position:absolute; left:0; bottom:-23; width:<?=$img_width?>px; height:20px; overflow:hidden; text-align:center; font-size:12px; color:#4C4C4C; background:;}
.latestList .btnPage {position:absolute; top:6px; right:0;}
.latestList .btnPage li {display:inline; float:left;}
.latestList.h2bg {border-bottom:none;}
.latestList.h2bg ul.btnPage {right:10px;}
.latestList.h2bg h2 {background:#ebebeb; -moz-border-radius: 5px;}
.latestList.h2bg h2 a {color:#000;}
</style>
<div class="latestList h2bg" >
<h2><img src="/gnu4/skin/latest/kplayer_latest_skin/img/icon.gif"> <a href="<?=$g4[bbs_path]?>/board.php?bo_table=<?=$bo_table?>"><?=$board[bo_subject]?></a></h2>
<ul class="btnPage">
<li><a href='<?=$g4[bbs_path]?>/board.php?bo_table=<?=$bo_table?>'><img src="<?=$latest_skin_path?>/img/box01_more.gif" width="47" height="13" border="0" alt="전체보기" title="전체보기" /></a></li>
</ul>
<ul class="thumb">
<?
for ($i=0; $i<count($list); $i++) {
?>
<li <?if($i==0){echo "class='first'";}?>>
<?
if($list[$i][file][0][view]){
$src = $list[$i][file][0][path]."/".$list[$i][file][0][file];
$get_img = getimagesize($src); // 파일정보를 가져옴
// 관리자가 이미지 사이즈를 바꾸었을때를 대비하여 리사이징 크기를 이름에 포함과 이미지 재 첨부시 바뀜
$img_step1 = explode("_",$list[$i][file][0][file]);
$img_step2 = explode(".",$img_step1[1]);
$new_imgname = $img_step2[0];
$thumb_file_list = "{$thumb_path}/{$img_width}x{$img_height}_{$new_imgname}_{$list[$i][wr_id]}_list";
if(!file_exists($thumb_file_list)){
// gd lib 체크
$gd = gd_info();
$gdversion = substr(preg_replace("/[^0-9]/", "", $gd['GD Version']), 0, 2); // gd 버전이 2.0 이상인지 체크
if(!$gdversion){
$thumb_file_view = $src; // gd 2.0 이하면 강제적으로 줄임
}else{
if($img_width > $get_img[0] || $img_height > $get_img[1]){
$thumb_file_list = $src;
}else{
createThumb_list($img_width,$img_height,$src, $thumb_file_list, $get_img); // list 페이지 썸네일
}
}
}
$img = "<a href='{$list[$i]['href']}'><img src=\"$thumb_file_list\" border=\"0\" width=\"$img_width\" height=\"$img_height\"/><span>{$list[$i]['subject']}</span></a>";
}else{
// no 이미지를 비율적으로 만들어났음
$img = "<a href='{$list[$i]['href']}'><img src=\"$latest_skin_path/img/noimage.png\" border=\"0\" height=\"{$img_height}\" width=\"{$img_width}\"/><span>{$list[$i]['subject']}</span></a>";
}
echo $img;
?>
</li>
<?}?>
<? if (count($list) == 0) { ?><li>게시물이 없습니다.</li><? } ?>
</ul>
</div>
댓글 전체
$img = "<a href='{$list[$i]['href']}'><img src=\"$thumb_file_list\" border=\"0\" width=\"$img_width\" height=\"$img_height\"/><span>{$list[$i]['subject']}</span>
<? if ($list[$i]['comment_cnt'])
echo " <a href=\"{$list[$i]['comment_href']}\"><span class='cmt'>{$list[$i]['comment_cnt']}</span></a>";
<? if ($list[$i]['comment_cnt'])
echo " <a href=\"{$list[$i]['comment_href']}\"><span class='cmt'>{$list[$i]['comment_cnt']}</span></a>";
감사드립니다. 오랜 고민이 해결되었습니다.