index에 게시글을 불러오려면..?? 정보
index에 게시글을 불러오려면..??본문
/bbs/board.php?bo_table=Board&wr_id=1 이와같이 리스트가 아닌 글보기를
최신글보기와 같이 넣으려고 하는데 얕은지식으로 잘 못하겠습니다.
인클루드방식도 안되고 아이프레임은 쓰면안된다니 다른방법을 알고계시면 지식좀 나눠주시면 감사하겠습니다.
최신글보기와 같이 넣으려고 하는데 얕은지식으로 잘 못하겠습니다.
인클루드방식도 안되고 아이프레임은 쓰면안된다니 다른방법을 알고계시면 지식좀 나눠주시면 감사하겠습니다.
댓글 전체

최근게시물 스킨을 변경하면 됩니다.
간단하게 설명드리자면
최근게시물 스킨에서
$list[$i][subject] 부분에다가
$list[$i][content]나
$list[$i][wr_content] 를 넣어보시면 이해가 빠르실 겁니다.
간단하게 설명드리자면
최근게시물 스킨에서
$list[$i][subject] 부분에다가
$list[$i][content]나
$list[$i][wr_content] 를 넣어보시면 이해가 빠르실 겁니다.
아 제 질문이 짧았습니다. 죄송합니다.
http://sir.co.kr/bbs/board.php?bo_table=g4_skin&wr_id=84369&sca=%B0%B6%B7%AF%B8%AE&page=3
위 스킨과 같이 슬라이드기능이 들어가는것이라 그냥 불러들일순 없을까 생각해서 입니다.
만약 방법이 없다면 서누니님 말씀대로 최신글을 가지고 노가다를 해야 할것 같긴합니다.
가능성 여부만 알려주시면 감사하겠습니다.
소중한 답변 감사 드립니다.
http://sir.co.kr/bbs/board.php?bo_table=g4_skin&wr_id=84369&sca=%B0%B6%B7%AF%B8%AE&page=3
위 스킨과 같이 슬라이드기능이 들어가는것이라 그냥 불러들일순 없을까 생각해서 입니다.
만약 방법이 없다면 서누니님 말씀대로 최신글을 가지고 노가다를 해야 할것 같긴합니다.
가능성 여부만 알려주시면 감사하겠습니다.
소중한 답변 감사 드립니다.

이지지 슬라이드 기능 부분만 추출하셔서 최근게시물로 만드시면 될것 같습니다.
최근게시물 작성 하실때 어차피 한개의 게시물만 나오게 하실 것 같은데
최근게시물에서 글 추출을 1로 적으시고
스킨 만드실때 img 파일도 복사를 해옵니다용.
그리고 대략적으로
<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
$ViewRows = 5; // 출력 개수
$rewidth = 100; // 썸네일 이미지 가로크기
$reheight = 62; // 썸네일 이미지 세로크기
$settime = 5; // 타임아웃 시간 (초)
$td_width = $rewidth + 16;
$td_height = $reheight + 52;
$file = array();
for ( $i = 0; $i < $list[0][file][count]; $i++ )
{
if ( $list[0][file][$i][file] )
$file[] = $list[0][file][$i];
}
?>
<div class='latest_area'>
<table>
<tr>
<td>
<div style='clear:both;'>
<table align=center cellpadding=0 cellspacing=0 border=0>
<tr>
<td><div id=fadein_content style='width:640px; height:400px; position:relative;'></div></td>
</tr>
</table>
</div>
<script language='javascript'>
var array_image = new Array();
</script>
<table width=100% cellpadding=0 cellspacing=0 border=0>
<tr>
<td style='padding:5px;' valign="bottom"><img src='<?=$latest_skin_path?>/img/arr01.gif' align=absmiddle onclick="prev_images()" style='cursor:pointer;' alt="이전" /></td>
<td>
<table align=center cellpadding=0 cellspacing=0 border=0>
<tr>
<td>
<div style='float:left; position:relative; width:<?=$td_width*$ViewRows?>px; height:<?=$td_height?>px; overflow:hidden;'>
<div id=image_layer style='position:absolute; left:0;'>
<table id=image_content cellpadding=0 cellspacing=0 border=0>
<tr>
<?
// 파일 출력
for ($i = 0; $i < count( $file ); $i++ )
{
$original_file = $file[$i][path]."/".$file[$i][file];
$thumb_file = $file[$i][path]."/thumb_".$file[$i][file];
if ( ! file_exists( $thumb_file ) ) // 썸네일 시작
{
list( $img_width, $img_height, $type ) = @getimagesize( $original_file );
if ( $type == 1 ) $img_sour = imagecreatefromgif( $original_file );
else if ( $type == 2 ) $img_sour = imagecreatefromjpeg( $original_file );
else if ( $type == 3 ) $img_sour = imagecreatefrompng( $original_file );
else return false;
if ( $img_width > $img_height )
{
$width = round( $reheight * $img_width / $img_height );
$height = $reheight;
}
else
{
$width = $rewidth;
$height = round( $rewidth * $img_height / $img_width );
}
if ( $width < $rewidth )
{
$width = round( ( $height + $rewidth - $width ) * $img_width / $img_height );
$height = round( ( $width + $rewidth - $width ) * $img_height / $img_width );
}
else if ($height < $reheight)
{
$height = round( ( $width + $reheight - $height ) * $img_height / $img_width );
$width = round( ( $height + $reheight - $height ) * $img_width / $img_height );
}
$x_last = round( ( $width - $rewidth ) / 2 );
$y_last = round( ( $height - $reheight ) / 2 );
if ( ( $img_width < $rewidth ) || ( $img_height < $reheight ) )
{
$img_last = imagecreatetruecolor( $rewidth, $reheight );
$x_last = round( ( $rewidth - $img_width ) / 2 );
$y_last = round( ( $reheight - $img_height ) / 2 );
imagecopy( $img_last, $img_sour, $x_last, $y_last, 0, 0, $width, $height );
imagedestroy( $img_sour );
$white = imagecolorallocate( $img_last, 255, 255, 255);
imagefill( $img_last, 0, 0, $white );
}
else
{
$img_dest = imagecreatetruecolor( $width, $height );
imagecopyresampled( $img_dest, $img_sour, 0, 0, 0, 0, $width, $height, $img_width, $img_height );
$img_last = imagecreatetruecolor( $rewidth, $reheight );
imagecopy( $img_last, $img_dest, 0, 0, $x_last, $y_last, $width, $height );
imagedestroy( $img_dest );
}
if ( $type == 1 ) imagegif($img_last, $thumb_file, 100);
else if ( $type == 2 ) imagejpeg($img_last, $thumb_file, 100);
else if ( $type == 3 ) imagepng($img_last, $thumb_file, 100);
imagedestroy($img_last);
} // 썸네일 끝
?>
<td style='padding:5px;' width=<?=$td_width?> height=<?=$td_height?> align=center valign=bottom onmouseover='image_over ( <?=$i?> )' onmouseout='image_out( <?=$i?> )'>
<div style='clear:both; text-align:left;'>
<img src='<?=$latest_skin_path?>/img/number<?=$i+1?>.gif' align=absmiddle>
</div>
<div style='clear:both;'>
<img src='<?=$thumb_file?>' id=thumb_image align=absmiddle style='border:3px solid #ffffff;'>
</div>
<!--
<div style='clear:both; text-align:left; font-size:8pt; font-family:dotum; padding:2px 0 2px 0;'>
<?=$file[$i][bf_content]?>
</div>
-->
</td>
<script language='javascript'>
array_image[<?=$i?>] = "<?=$original_file?>";
</script>
<?
}
?>
</tr>
</table>
</div>
</div>
</td>
</tr>
</table>
</td>
<td style='padding:5px;' valign="bottom"><img src='<?=$latest_skin_path?>/img/arr02.gif' align=absmiddle onclick="next_images()" style='cursor:pointer;' alt="다음" /></td>
</tr>
</table>
</td>
</tr>
</table>
</div>
<script type="text/javascript">
var NowImg = 0;
var ViewRows = parseInt( <?=$ViewRows?> ); // 보여지는 개수
var TotalRows = parseInt( <?=count( $file )?> ); // 전체 개수
var TdWidth = parseInt( <?=$td_width?> ); // 한칸당 가로 크기
var before_FilePath; // 패이드인 이전 파일
var MoveNum = 0;
var Stv; // 타임아웃
function fadein_over( FilePath )
{
if ( before_FilePath == FilePath )
return;
before_FilePath = FilePath;
parent_node = document.getElementById( "fadein_content" );
if ( ! parent_node.width ) parent_node.width = parseInt( parent_node.style.width, 10 );
if ( ! parent_node.height ) parent_node.height = parseInt( parent_node.style.height, 10 );
TargetDiv = parent_node.getElementsByTagName( "A" )[0];
if ( typeof( TargetDiv ) == "undefined" )
TargetDiv = parent_node;
TargetDiv_element = TargetDiv.getElementsByTagName( "IMG" );
// DIV 엘리먼트가 10 개 정도 되면 하나씩 삭제
if ( TargetDiv_element.length >= 10 )
TargetDiv.removeChild( TargetDiv_element[0] );
element = document.createElement( "IMG" );
element.style.position = "absolute";
element.style.width = parent_node.width+"px";
element.style.height = parent_node.height+"px";
element.src = FilePath;
if ( navigator.appName == "Microsoft Internet Explorer" )
element.style.filter = "Alpha(opacity=0)";
else
element.style.opacity = "0.0";
TargetDiv.appendChild( element );
setTimeout( "fadein( element )", 10 );
}
function fadein( element )
{
number = element.getAttribute( "number" );
if ( ! number )
number = 0;
if ( navigator.appName == "Microsoft Internet Explorer" )
{
number = parseInt( number );
number += 5;
element.style.filter = "Alpha(opacity="+number+")";
if ( parseInt( number ) >= 100 )
{
element.style.filter = "Alpha(opacity=100)";
return;
}
}
else
{
number = parseFloat( number );
number += 0.05;
element.style.opacity = number;
if ( parseInt( number ) >= 1 )
{
element.style.opacity = 1;
return;
}
}
element.setAttribute( "number", number );
setTimeout( "fadein( element )", 10 );
}
function next_images()
{
clearTimeout( Stv );
NowImg++;
if ( NowImg > TotalRows - 1 )
NowImg = 0;
image_border ( NowImg );
fadein_over( array_image[NowImg] );
Stv = setTimeout( 'next_images()', <?=$settime*1000?> );
MoveNum = NowImg;
return;
}
function prev_images()
{
clearTimeout( Stv );
NowImg--;
if ( NowImg < 0 )
NowImg = TotalRows - 1;
image_border ( NowImg );
fadein_over( array_image[NowImg] );
Stv = setTimeout( 'next_images()', <?=$settime*1000?> );
MoveNum = NowImg;
return;
}
function move_content()
{
NowLeft = parseInt( document.getElementById( "image_layer" ).style.left, 10 );
LeftLoc = Math.ceil( Math.abs( NowLeft - ( MoveNum * TdWidth ) ) / 2 );
if ( ViewRows + MoveNum > TotalRows )
LeftLoc = Math.ceil( Math.abs( NowLeft - ( ( TotalRows - ViewRows ) * TdWidth ) ) / 2 );
if ( TotalRows <= ViewRows )
LeftLoc = 0;
document.getElementById( "image_layer" ).style.left = -LeftLoc+"px";
}
function image_border ( num )
{
content = document.getElementById( "image_content" ).getElementsByTagName( "IMG" );
for ( i = 0, k = 0; i < content.length; i++ )
{
if ( content[i].getAttribute( "id" ) == "thumb_image" )
{
content[i].style.border = num == k ? "3px solid #ff6347" : "3px solid #ffffff" ;
k++;
}
}
return;
}
function image_over ( num )
{
NowImg = num;
image_border ( num );
fadein_over( array_image[num] );
clearTimeout( Stv );
return;
}
function image_out ( num )
{
NowImg = num;
image_border ( num );
fadein_over( array_image[num] );
Stv = setTimeout( 'next_images()', <?=$settime*1000?> );
return;
}
window.onload = function()
{
resizeBoardImage(<?=(int)$board[bo_image_width]?>);
drawFont();
<?
if ( $file[0][file] )
{
echo "fadein_over( array_image[0] );\n";
echo "image_border ( 0 );\n";
}
if ( $file[1][file] )
{
echo "Stv = setTimeout( 'next_images()', ".($settime*1000)." );\n";
echo "setInterval( 'move_content()', 1 )\n";
}
?>
}
</script>
이정도로 짜면 나올법도 합니다만
최근게시물 작성 하실때 어차피 한개의 게시물만 나오게 하실 것 같은데
최근게시물에서 글 추출을 1로 적으시고
스킨 만드실때 img 파일도 복사를 해옵니다용.
그리고 대략적으로
<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
$ViewRows = 5; // 출력 개수
$rewidth = 100; // 썸네일 이미지 가로크기
$reheight = 62; // 썸네일 이미지 세로크기
$settime = 5; // 타임아웃 시간 (초)
$td_width = $rewidth + 16;
$td_height = $reheight + 52;
$file = array();
for ( $i = 0; $i < $list[0][file][count]; $i++ )
{
if ( $list[0][file][$i][file] )
$file[] = $list[0][file][$i];
}
?>
<div class='latest_area'>
<table>
<tr>
<td>
<div style='clear:both;'>
<table align=center cellpadding=0 cellspacing=0 border=0>
<tr>
<td><div id=fadein_content style='width:640px; height:400px; position:relative;'></div></td>
</tr>
</table>
</div>
<script language='javascript'>
var array_image = new Array();
</script>
<table width=100% cellpadding=0 cellspacing=0 border=0>
<tr>
<td style='padding:5px;' valign="bottom"><img src='<?=$latest_skin_path?>/img/arr01.gif' align=absmiddle onclick="prev_images()" style='cursor:pointer;' alt="이전" /></td>
<td>
<table align=center cellpadding=0 cellspacing=0 border=0>
<tr>
<td>
<div style='float:left; position:relative; width:<?=$td_width*$ViewRows?>px; height:<?=$td_height?>px; overflow:hidden;'>
<div id=image_layer style='position:absolute; left:0;'>
<table id=image_content cellpadding=0 cellspacing=0 border=0>
<tr>
<?
// 파일 출력
for ($i = 0; $i < count( $file ); $i++ )
{
$original_file = $file[$i][path]."/".$file[$i][file];
$thumb_file = $file[$i][path]."/thumb_".$file[$i][file];
if ( ! file_exists( $thumb_file ) ) // 썸네일 시작
{
list( $img_width, $img_height, $type ) = @getimagesize( $original_file );
if ( $type == 1 ) $img_sour = imagecreatefromgif( $original_file );
else if ( $type == 2 ) $img_sour = imagecreatefromjpeg( $original_file );
else if ( $type == 3 ) $img_sour = imagecreatefrompng( $original_file );
else return false;
if ( $img_width > $img_height )
{
$width = round( $reheight * $img_width / $img_height );
$height = $reheight;
}
else
{
$width = $rewidth;
$height = round( $rewidth * $img_height / $img_width );
}
if ( $width < $rewidth )
{
$width = round( ( $height + $rewidth - $width ) * $img_width / $img_height );
$height = round( ( $width + $rewidth - $width ) * $img_height / $img_width );
}
else if ($height < $reheight)
{
$height = round( ( $width + $reheight - $height ) * $img_height / $img_width );
$width = round( ( $height + $reheight - $height ) * $img_width / $img_height );
}
$x_last = round( ( $width - $rewidth ) / 2 );
$y_last = round( ( $height - $reheight ) / 2 );
if ( ( $img_width < $rewidth ) || ( $img_height < $reheight ) )
{
$img_last = imagecreatetruecolor( $rewidth, $reheight );
$x_last = round( ( $rewidth - $img_width ) / 2 );
$y_last = round( ( $reheight - $img_height ) / 2 );
imagecopy( $img_last, $img_sour, $x_last, $y_last, 0, 0, $width, $height );
imagedestroy( $img_sour );
$white = imagecolorallocate( $img_last, 255, 255, 255);
imagefill( $img_last, 0, 0, $white );
}
else
{
$img_dest = imagecreatetruecolor( $width, $height );
imagecopyresampled( $img_dest, $img_sour, 0, 0, 0, 0, $width, $height, $img_width, $img_height );
$img_last = imagecreatetruecolor( $rewidth, $reheight );
imagecopy( $img_last, $img_dest, 0, 0, $x_last, $y_last, $width, $height );
imagedestroy( $img_dest );
}
if ( $type == 1 ) imagegif($img_last, $thumb_file, 100);
else if ( $type == 2 ) imagejpeg($img_last, $thumb_file, 100);
else if ( $type == 3 ) imagepng($img_last, $thumb_file, 100);
imagedestroy($img_last);
} // 썸네일 끝
?>
<td style='padding:5px;' width=<?=$td_width?> height=<?=$td_height?> align=center valign=bottom onmouseover='image_over ( <?=$i?> )' onmouseout='image_out( <?=$i?> )'>
<div style='clear:both; text-align:left;'>
<img src='<?=$latest_skin_path?>/img/number<?=$i+1?>.gif' align=absmiddle>
</div>
<div style='clear:both;'>
<img src='<?=$thumb_file?>' id=thumb_image align=absmiddle style='border:3px solid #ffffff;'>
</div>
<!--
<div style='clear:both; text-align:left; font-size:8pt; font-family:dotum; padding:2px 0 2px 0;'>
<?=$file[$i][bf_content]?>
</div>
-->
</td>
<script language='javascript'>
array_image[<?=$i?>] = "<?=$original_file?>";
</script>
<?
}
?>
</tr>
</table>
</div>
</div>
</td>
</tr>
</table>
</td>
<td style='padding:5px;' valign="bottom"><img src='<?=$latest_skin_path?>/img/arr02.gif' align=absmiddle onclick="next_images()" style='cursor:pointer;' alt="다음" /></td>
</tr>
</table>
</td>
</tr>
</table>
</div>
<script type="text/javascript">
var NowImg = 0;
var ViewRows = parseInt( <?=$ViewRows?> ); // 보여지는 개수
var TotalRows = parseInt( <?=count( $file )?> ); // 전체 개수
var TdWidth = parseInt( <?=$td_width?> ); // 한칸당 가로 크기
var before_FilePath; // 패이드인 이전 파일
var MoveNum = 0;
var Stv; // 타임아웃
function fadein_over( FilePath )
{
if ( before_FilePath == FilePath )
return;
before_FilePath = FilePath;
parent_node = document.getElementById( "fadein_content" );
if ( ! parent_node.width ) parent_node.width = parseInt( parent_node.style.width, 10 );
if ( ! parent_node.height ) parent_node.height = parseInt( parent_node.style.height, 10 );
TargetDiv = parent_node.getElementsByTagName( "A" )[0];
if ( typeof( TargetDiv ) == "undefined" )
TargetDiv = parent_node;
TargetDiv_element = TargetDiv.getElementsByTagName( "IMG" );
// DIV 엘리먼트가 10 개 정도 되면 하나씩 삭제
if ( TargetDiv_element.length >= 10 )
TargetDiv.removeChild( TargetDiv_element[0] );
element = document.createElement( "IMG" );
element.style.position = "absolute";
element.style.width = parent_node.width+"px";
element.style.height = parent_node.height+"px";
element.src = FilePath;
if ( navigator.appName == "Microsoft Internet Explorer" )
element.style.filter = "Alpha(opacity=0)";
else
element.style.opacity = "0.0";
TargetDiv.appendChild( element );
setTimeout( "fadein( element )", 10 );
}
function fadein( element )
{
number = element.getAttribute( "number" );
if ( ! number )
number = 0;
if ( navigator.appName == "Microsoft Internet Explorer" )
{
number = parseInt( number );
number += 5;
element.style.filter = "Alpha(opacity="+number+")";
if ( parseInt( number ) >= 100 )
{
element.style.filter = "Alpha(opacity=100)";
return;
}
}
else
{
number = parseFloat( number );
number += 0.05;
element.style.opacity = number;
if ( parseInt( number ) >= 1 )
{
element.style.opacity = 1;
return;
}
}
element.setAttribute( "number", number );
setTimeout( "fadein( element )", 10 );
}
function next_images()
{
clearTimeout( Stv );
NowImg++;
if ( NowImg > TotalRows - 1 )
NowImg = 0;
image_border ( NowImg );
fadein_over( array_image[NowImg] );
Stv = setTimeout( 'next_images()', <?=$settime*1000?> );
MoveNum = NowImg;
return;
}
function prev_images()
{
clearTimeout( Stv );
NowImg--;
if ( NowImg < 0 )
NowImg = TotalRows - 1;
image_border ( NowImg );
fadein_over( array_image[NowImg] );
Stv = setTimeout( 'next_images()', <?=$settime*1000?> );
MoveNum = NowImg;
return;
}
function move_content()
{
NowLeft = parseInt( document.getElementById( "image_layer" ).style.left, 10 );
LeftLoc = Math.ceil( Math.abs( NowLeft - ( MoveNum * TdWidth ) ) / 2 );
if ( ViewRows + MoveNum > TotalRows )
LeftLoc = Math.ceil( Math.abs( NowLeft - ( ( TotalRows - ViewRows ) * TdWidth ) ) / 2 );
if ( TotalRows <= ViewRows )
LeftLoc = 0;
document.getElementById( "image_layer" ).style.left = -LeftLoc+"px";
}
function image_border ( num )
{
content = document.getElementById( "image_content" ).getElementsByTagName( "IMG" );
for ( i = 0, k = 0; i < content.length; i++ )
{
if ( content[i].getAttribute( "id" ) == "thumb_image" )
{
content[i].style.border = num == k ? "3px solid #ff6347" : "3px solid #ffffff" ;
k++;
}
}
return;
}
function image_over ( num )
{
NowImg = num;
image_border ( num );
fadein_over( array_image[num] );
clearTimeout( Stv );
return;
}
function image_out ( num )
{
NowImg = num;
image_border ( num );
fadein_over( array_image[num] );
Stv = setTimeout( 'next_images()', <?=$settime*1000?> );
return;
}
window.onload = function()
{
resizeBoardImage(<?=(int)$board[bo_image_width]?>);
drawFont();
<?
if ( $file[0][file] )
{
echo "fadein_over( array_image[0] );\n";
echo "image_border ( 0 );\n";
}
if ( $file[1][file] )
{
echo "Stv = setTimeout( 'next_images()', ".($settime*1000)." );\n";
echo "setInterval( 'move_content()', 1 )\n";
}
?>
}
</script>
이정도로 짜면 나올법도 합니다만
미쳐 생각 못했던거였습니다.
친히 소스까지 올려주시고 너무 감사드리고 잘배웠습니다.
잘 적용해보겠습니다.^^
친히 소스까지 올려주시고 너무 감사드리고 잘배웠습니다.
잘 적용해보겠습니다.^^