최근갤러리에 코멘트 내용 출력하려면? 정보
최근갤러리에 코멘트 내용 출력하려면?본문
메인페이지에 갤러리형태의 최근게시물을 넣었습니다.
스킨이 갤러리 사진별로 바뀌면서 자동으로 돌아갑니다.
여기서 내용과 제목은 나오고...코멘트 개수 출력하는것 까진 제가 알겠는데....
해당게시물의 코멘트내용이 나오게 하려면 어떻게 해야할까요?
그리고 코멘트가 개수대로 다 나오는게 아니라 두개정도나오고 글자수 제한이 있었음 좋겟는데
어떻게 해야할지 모르겠어요.
여러가지 스킨들보고 응용도 해보고 수정도 해보고 그랫는데 잘 안되네요.
아시는분 부탁드립니다.
아래 주소에 최근갤러리 나와있어요.
또 아래 소스가 적용시킨 스킨소스에요.
http://www.gyswc.or.kr/gboard/main1.php
<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
$img_width = 200; //큰 썸네일 가로
$img_height = 130; //큰 썸네일 세로
$img_width_s = 48; //작은 썸네일 가로
$img_height_s = 40; //작은 썸네일 세로
$img_quality = 90; //썸네일 퀄리티
if (!function_exists("imagecopyresampled")) alert("GD 2.0.1 이상 버전이 설치되어 있어야 사용할 수 있는 갤러리 게시판 입니다.");
$data_path = $g4[path]."/data/file/$bo_table";
$thumb_path = $data_path.'/thumb_ch01';
$ym = date("ym", $g4[server_time]);
@mkdir($thumb_path, 0707);
@chmod($thumb_path, 0707);
//코멘트와 리플글은 제외
$sql = " select * from $tmp_write_table
where wr_comment = '' and wr_reply = ''
order by wr_id DESC LIMIT 0, 1 ";
$result = sql_query($sql);
$last_con = sql_fetch_array($result);
?>
<SCRIPT type=text/javascript>
<!--
old_debate_M='1';
function ComeonM(objid_M){
document.getElementById("debate_M"+old_debate_M).style.display="none";
document.getElementById("debate_M"+old_debate_M+"#1").style.display="";
document.getElementById("debate_M"+objid_M+"#1").style.display="none";
document.getElementById("debate_M"+objid_M).style.display="";
document.getElementById("debate_content_M"+old_debate_M).style.display="none";
document.getElementById("debate_content_M"+objid_M).style.display="";
old_debate_M=objid_M;
}
var objid_M = 1;
var interval_best;
function best_change_M()
{
if( objid_M == 5 ) // 오버랩 갯수
objid_M = 1;
else
objid_M++;
ComeonM(objid_M);
}
function setInterval_best()
{
interval_best = setInterval("best_change_M()", 5000);//속도조절
}
function clearInterval_best()
{
clearInterval(interval_best);
}
setInterval_best();
//-->
</SCRIPT>
<table width="100%" cellpadding="0" cellspacing="0" border="0" >
<tr><td><img src="<?=$latest_skin_path?>/img/icon_table.gif" width="20" height="18" border="0" align="absmiddle"><STRONG><?=$board[bo_subject]?></STRONG></td>
<td align="right"><a href='<?=$g4[bbs_path]?>/board.php?bo_table=<?=$bo_table?>'><img src="<?=$latest_skin_path?>/img/icon_more.gif" width="40" height="12" border="0" align="absmiddle"></a>
</td></tr>
<tr><td colspan="2" height="1" bgcolor="#eeeeee"></td></tr>
<tr><td colspan="2" height="10"></td></tr>
</table>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr><td>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr><td>
<? for ($i=0; $i<count($list); $i++) {
$j = $i + 1;
if ($j == "1") {
echo "<DIV>";
echo "<DIV id=debate_content_M$j onmouseover=clearInterval_best() onmouseout=setInterval_best()>"; }
else { echo "<DIV id=debate_content_M$j onmouseover=clearInterval_best() onmouseout=setInterval_best() style='DISPLAY: none;'>\n"; }
?>
<div style="float:left;width:200px;">
<?
//썸네일 생성
$thumfile = "";
$thumb = $thumb_path.'/'.$list[$i][wr_id];
// 썸네일 이미지가 존재하지 않는다면
if (!file_exists($thumb)) {
$file = $list[$i][file][0][path] .'/'. $list[$i][file][0][file];
// 업로드된 파일이 이미지라면
if (preg_match("/\.(jp[e]?g|gif|png)$/i", $file) && file_exists($file)) {
$size = getimagesize($file);
if ($size[2] == 1)
$src = imagecreatefromgif($file);
else if ($size[2] == 2)
$src = imagecreatefromjpeg($file);
else if ($size[2] == 3)
$src = imagecreatefrompng($file);
else
break;
$rate = $img_width / $size[0];
$height = (int)($size[1] * $rate);
// 계산된 썸네일 이미지의 높이가 설정된 이미지의 높이보다 작다면
if ($height < $img_height)
// 계산된 이미지 높이로 복사본 이미지 생성
$dst = imagecreatetruecolor($img_width, $height);
else
// 설정된 이미지 높이로 복사본 이미지 생성
$dst = imagecreatetruecolor($img_width, $img_height);
imagecopyresampled($dst, $src, 0, 0, 0, 0, $img_width, $height, $size[0], $size[1]);
imagejpeg($dst, $thumb_path.'/'.$list[$i][wr_id], $img_quality);
chmod($thumb_path.'/'.$list[$i][wr_id], 0606);
} else { //게디터에서 삽입한 이미지 뽑자ㅠㅠ
$edit_img = $list[$i]['wr_content'];
///////////////////////////// 변경된 부분
// if (eregi("data/geditor/{$ym}/[^<>]*\.(gif|jpg|png|bmp)", $edit_img, $tmp)) { // geditor 사용할 경우주석풀어서 사용
// if (eregi("data/cheditor/{$ym}/[^<>]*\.(gif|jpg|png|bmp)", $edit_img, $tmp)) { // chedito 사용할 경우주석풀어서 사용
if (eregi("data/cheditor4/{$ym}/[^<>]*\.(gif|jpg|png|bmp)", $edit_img, $tmp)) { // 에디터가 cheditor4 이면 주석풀어서 사용
$file = './' . $tmp[0]; // 파일경로 필요에 따라 변경하세요 . or ..
$size = getimagesize($file);
if ($size[2] == 1)
$src = imagecreatefromgif($file);
else if ($size[2] == 2)
$src = imagecreatefromjpeg($file);
else if ($size[2] == 3)
$src = imagecreatefrompng($file);
else
break;
$rate = $img_width / $size[0];
$height = (int)($size[1] * $rate);
// 계산된 썸네일 이미지의 높이가 설정된 이미지의 높이보다 작다면
if ($height < $img_height)
// 계산된 이미지 높이로 복사본 이미지 생성
$dst = imagecreatetruecolor($img_width, $height);
else
// 설정된 이미지 높이로 복사본 이미지 생성
$dst = imagecreatetruecolor($img_width, $img_height);
imagecopyresampled($dst, $src, 0, 0, 0, 0, $img_width, $height, $size[0], $size[1]);
imagejpeg($dst, $thumb_path.'/'.$list[$i][wr_id], $img_quality);
chmod($thumb_path.'/'.$list[$i][wr_id], 0606);
}
}
}
if (file_exists($thumb))
$thumfile = "<img src='$thumb' width='{$img_width}' height='{$img_height}' border='0' style='border:0px #ccc solid'></a>";
else
//이미지가 없으면
$thumfile="<img src='$latest_skin_path/img/noimg.gif' width='{$img_width}' height='{$img_height}' style='border:0 #E7E7E7 solid'></a>";
//이미지가 아니네
if(preg_match("/\.(swf|wma|asf)$/i","$file") && file_exists($file))
{ $thumfile = "<script>doc_write(flash_movie('$file', 'flash$i', '$img_width', '$img_height', 'transparent'));</script>"; }
?><a href='<?=$list[$i][href]?>'><?=$thumfile?></a>
</div>
<div style="float:right; width:270px; height:90px; padding:0 0 0 6px;">
<span style="font-size:14px; letter-spacing:-1px; line-height:17px;">
<a href='<?=$list[$i][href]?>'><strong><?=$list[$i][subject]?></strong></a></span>
<br />
<span style="font-size:11px; font-family:돋움; letter-spacing:-1px; line-height:14px; color:#999;"><?=cut_str(strip_tags($list[$i][wr_content]),150,"...")?></span>
</div>
<?
echo "</DIV>";
}
?>
<div style="float:left; padding:0 0 0 10px;">
<? for ($i=0; $i<count($list); $i++) {
////////////////////////////////////////////////////////////////////////////////////////////////////
//////// data/cheditor/ 불러오던 원본값을 썸디렉에서 가져오게 변경
////////////////////////////////////////////////////////////////////////////////////////////////////
$k = $i + 1;
$thumb = $thumb_path.'/'.$list[$i][wr_id];
if (file_exists($thumb))
$thumfile = "'$thumb'";
else
//이미지가 없으면
$thumfile="<img src='$latest_skin_path/img/noimg.gif' width='{$img_width_s}' height='{$img_height_s}' style='border:0 #E7E7E7 solid'></a>";
//이미지가 아니네
if(preg_match("/\.(swf|wma|asf)$/i","$file") && file_exists($file))
{ $thumfile = "<script>doc_write(flash_movie('$file', 'flash$i', '$img_width', '$img_height', 'transparent'));</script>"; }
?>
<a href="<?=$list[$i][href]?>" onMouseOver="javascript:ComeonM('<?=$k?>')">
<img src=<?=$thumfile?> width="<?=$img_width_s?>" height="<?=$img_height_s?>" hspace="0" id="debate_M<?=$k?>" onMouseOver="clearInterval_best()" onMouseOut="setInterval_best()" <? if($k == "1") { echo "style='border:2px solid #FF9900;'";} else { echo "style='DISPLAY: none; border:2px solid #FF9900;' ";}
?>><img src=<?=$thumfile?> width="<?=$img_width_s?>" height="<?=$img_height_s?>" hspace="0" border="0" id="debate_M<?=$k?>#1" <? if($k == "1") { echo "style='DISPLAY: none; border:2px solid #FFFFFF;'"; }else { echo "style='border:2px solid #FFFFFF;'";} ?>></a><? } ?>
</div>
</td></tr></table></td></tr></table>
스킨이 갤러리 사진별로 바뀌면서 자동으로 돌아갑니다.
여기서 내용과 제목은 나오고...코멘트 개수 출력하는것 까진 제가 알겠는데....
해당게시물의 코멘트내용이 나오게 하려면 어떻게 해야할까요?
그리고 코멘트가 개수대로 다 나오는게 아니라 두개정도나오고 글자수 제한이 있었음 좋겟는데
어떻게 해야할지 모르겠어요.
여러가지 스킨들보고 응용도 해보고 수정도 해보고 그랫는데 잘 안되네요.
아시는분 부탁드립니다.
아래 주소에 최근갤러리 나와있어요.
또 아래 소스가 적용시킨 스킨소스에요.
http://www.gyswc.or.kr/gboard/main1.php
<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
$img_width = 200; //큰 썸네일 가로
$img_height = 130; //큰 썸네일 세로
$img_width_s = 48; //작은 썸네일 가로
$img_height_s = 40; //작은 썸네일 세로
$img_quality = 90; //썸네일 퀄리티
if (!function_exists("imagecopyresampled")) alert("GD 2.0.1 이상 버전이 설치되어 있어야 사용할 수 있는 갤러리 게시판 입니다.");
$data_path = $g4[path]."/data/file/$bo_table";
$thumb_path = $data_path.'/thumb_ch01';
$ym = date("ym", $g4[server_time]);
@mkdir($thumb_path, 0707);
@chmod($thumb_path, 0707);
//코멘트와 리플글은 제외
$sql = " select * from $tmp_write_table
where wr_comment = '' and wr_reply = ''
order by wr_id DESC LIMIT 0, 1 ";
$result = sql_query($sql);
$last_con = sql_fetch_array($result);
?>
<SCRIPT type=text/javascript>
<!--
old_debate_M='1';
function ComeonM(objid_M){
document.getElementById("debate_M"+old_debate_M).style.display="none";
document.getElementById("debate_M"+old_debate_M+"#1").style.display="";
document.getElementById("debate_M"+objid_M+"#1").style.display="none";
document.getElementById("debate_M"+objid_M).style.display="";
document.getElementById("debate_content_M"+old_debate_M).style.display="none";
document.getElementById("debate_content_M"+objid_M).style.display="";
old_debate_M=objid_M;
}
var objid_M = 1;
var interval_best;
function best_change_M()
{
if( objid_M == 5 ) // 오버랩 갯수
objid_M = 1;
else
objid_M++;
ComeonM(objid_M);
}
function setInterval_best()
{
interval_best = setInterval("best_change_M()", 5000);//속도조절
}
function clearInterval_best()
{
clearInterval(interval_best);
}
setInterval_best();
//-->
</SCRIPT>
<table width="100%" cellpadding="0" cellspacing="0" border="0" >
<tr><td><img src="<?=$latest_skin_path?>/img/icon_table.gif" width="20" height="18" border="0" align="absmiddle"><STRONG><?=$board[bo_subject]?></STRONG></td>
<td align="right"><a href='<?=$g4[bbs_path]?>/board.php?bo_table=<?=$bo_table?>'><img src="<?=$latest_skin_path?>/img/icon_more.gif" width="40" height="12" border="0" align="absmiddle"></a>
</td></tr>
<tr><td colspan="2" height="1" bgcolor="#eeeeee"></td></tr>
<tr><td colspan="2" height="10"></td></tr>
</table>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr><td>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr><td>
<? for ($i=0; $i<count($list); $i++) {
$j = $i + 1;
if ($j == "1") {
echo "<DIV>";
echo "<DIV id=debate_content_M$j onmouseover=clearInterval_best() onmouseout=setInterval_best()>"; }
else { echo "<DIV id=debate_content_M$j onmouseover=clearInterval_best() onmouseout=setInterval_best() style='DISPLAY: none;'>\n"; }
?>
<div style="float:left;width:200px;">
<?
//썸네일 생성
$thumfile = "";
$thumb = $thumb_path.'/'.$list[$i][wr_id];
// 썸네일 이미지가 존재하지 않는다면
if (!file_exists($thumb)) {
$file = $list[$i][file][0][path] .'/'. $list[$i][file][0][file];
// 업로드된 파일이 이미지라면
if (preg_match("/\.(jp[e]?g|gif|png)$/i", $file) && file_exists($file)) {
$size = getimagesize($file);
if ($size[2] == 1)
$src = imagecreatefromgif($file);
else if ($size[2] == 2)
$src = imagecreatefromjpeg($file);
else if ($size[2] == 3)
$src = imagecreatefrompng($file);
else
break;
$rate = $img_width / $size[0];
$height = (int)($size[1] * $rate);
// 계산된 썸네일 이미지의 높이가 설정된 이미지의 높이보다 작다면
if ($height < $img_height)
// 계산된 이미지 높이로 복사본 이미지 생성
$dst = imagecreatetruecolor($img_width, $height);
else
// 설정된 이미지 높이로 복사본 이미지 생성
$dst = imagecreatetruecolor($img_width, $img_height);
imagecopyresampled($dst, $src, 0, 0, 0, 0, $img_width, $height, $size[0], $size[1]);
imagejpeg($dst, $thumb_path.'/'.$list[$i][wr_id], $img_quality);
chmod($thumb_path.'/'.$list[$i][wr_id], 0606);
} else { //게디터에서 삽입한 이미지 뽑자ㅠㅠ
$edit_img = $list[$i]['wr_content'];
///////////////////////////// 변경된 부분
// if (eregi("data/geditor/{$ym}/[^<>]*\.(gif|jpg|png|bmp)", $edit_img, $tmp)) { // geditor 사용할 경우주석풀어서 사용
// if (eregi("data/cheditor/{$ym}/[^<>]*\.(gif|jpg|png|bmp)", $edit_img, $tmp)) { // chedito 사용할 경우주석풀어서 사용
if (eregi("data/cheditor4/{$ym}/[^<>]*\.(gif|jpg|png|bmp)", $edit_img, $tmp)) { // 에디터가 cheditor4 이면 주석풀어서 사용
$file = './' . $tmp[0]; // 파일경로 필요에 따라 변경하세요 . or ..
$size = getimagesize($file);
if ($size[2] == 1)
$src = imagecreatefromgif($file);
else if ($size[2] == 2)
$src = imagecreatefromjpeg($file);
else if ($size[2] == 3)
$src = imagecreatefrompng($file);
else
break;
$rate = $img_width / $size[0];
$height = (int)($size[1] * $rate);
// 계산된 썸네일 이미지의 높이가 설정된 이미지의 높이보다 작다면
if ($height < $img_height)
// 계산된 이미지 높이로 복사본 이미지 생성
$dst = imagecreatetruecolor($img_width, $height);
else
// 설정된 이미지 높이로 복사본 이미지 생성
$dst = imagecreatetruecolor($img_width, $img_height);
imagecopyresampled($dst, $src, 0, 0, 0, 0, $img_width, $height, $size[0], $size[1]);
imagejpeg($dst, $thumb_path.'/'.$list[$i][wr_id], $img_quality);
chmod($thumb_path.'/'.$list[$i][wr_id], 0606);
}
}
}
if (file_exists($thumb))
$thumfile = "<img src='$thumb' width='{$img_width}' height='{$img_height}' border='0' style='border:0px #ccc solid'></a>";
else
//이미지가 없으면
$thumfile="<img src='$latest_skin_path/img/noimg.gif' width='{$img_width}' height='{$img_height}' style='border:0 #E7E7E7 solid'></a>";
//이미지가 아니네
if(preg_match("/\.(swf|wma|asf)$/i","$file") && file_exists($file))
{ $thumfile = "<script>doc_write(flash_movie('$file', 'flash$i', '$img_width', '$img_height', 'transparent'));</script>"; }
?><a href='<?=$list[$i][href]?>'><?=$thumfile?></a>
</div>
<div style="float:right; width:270px; height:90px; padding:0 0 0 6px;">
<span style="font-size:14px; letter-spacing:-1px; line-height:17px;">
<a href='<?=$list[$i][href]?>'><strong><?=$list[$i][subject]?></strong></a></span>
<br />
<span style="font-size:11px; font-family:돋움; letter-spacing:-1px; line-height:14px; color:#999;"><?=cut_str(strip_tags($list[$i][wr_content]),150,"...")?></span>
</div>
<?
echo "</DIV>";
}
?>
<div style="float:left; padding:0 0 0 10px;">
<? for ($i=0; $i<count($list); $i++) {
////////////////////////////////////////////////////////////////////////////////////////////////////
//////// data/cheditor/ 불러오던 원본값을 썸디렉에서 가져오게 변경
////////////////////////////////////////////////////////////////////////////////////////////////////
$k = $i + 1;
$thumb = $thumb_path.'/'.$list[$i][wr_id];
if (file_exists($thumb))
$thumfile = "'$thumb'";
else
//이미지가 없으면
$thumfile="<img src='$latest_skin_path/img/noimg.gif' width='{$img_width_s}' height='{$img_height_s}' style='border:0 #E7E7E7 solid'></a>";
//이미지가 아니네
if(preg_match("/\.(swf|wma|asf)$/i","$file") && file_exists($file))
{ $thumfile = "<script>doc_write(flash_movie('$file', 'flash$i', '$img_width', '$img_height', 'transparent'));</script>"; }
?>
<a href="<?=$list[$i][href]?>" onMouseOver="javascript:ComeonM('<?=$k?>')">
<img src=<?=$thumfile?> width="<?=$img_width_s?>" height="<?=$img_height_s?>" hspace="0" id="debate_M<?=$k?>" onMouseOver="clearInterval_best()" onMouseOut="setInterval_best()" <? if($k == "1") { echo "style='border:2px solid #FF9900;'";} else { echo "style='DISPLAY: none; border:2px solid #FF9900;' ";}
?>><img src=<?=$thumfile?> width="<?=$img_width_s?>" height="<?=$img_height_s?>" hspace="0" border="0" id="debate_M<?=$k?>#1" <? if($k == "1") { echo "style='DISPLAY: none; border:2px solid #FFFFFF;'"; }else { echo "style='border:2px solid #FFFFFF;'";} ?>></a><? } ?>
</div>
</td></tr></table></td></tr></table>
댓글 전체