아래에서 위로 스크롤되는 겔러리 최신글 문제;;; 고수님들 도와주세요.. 정보
아래에서 위로 스크롤되는 겔러리 최신글 문제;;; 고수님들 도와주세요..본문
고수님들의 도움이 필요합니다. ㅠㅠ
http://www.sir.co.kr/bbs/board.php?bo_table=g4_skin&wr_id=11339
위의 최신글 스킨을 적용하려고 합니다.
최신글 스킨 원본소스는 아래와 같습니다.
<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
if (!$board[bo_9]) alert("해당 게시판 설정 : 여분 필드 9 에 목록에서 보여질 이미지의 질(quality)을 비율로 설정하십시오. (100 이하)");
if (!$board[bo_7]) alert("게시판 설정 : 여분 필드 7 에 목록에서 내용길이를 입력하십시오.");
if (!function_exists("imagecopyresampled")) alert("GD 2.0.1 이상 버전이 설치되어 있어야 사용할 수 있는 스킨 입니다.");
$data_path = $g4[path]."/data/file/$bo_table";
$thumb_path = $data_path.'/thumb100';
@mkdir($thumb_path, 0707);
@chmod($thumb_path, 0707);
?>
<script language="JavaScript">
<!--
var scrollerwidth = 238;
var scrollerheight = 150;
var scrollerbgcolor = '';
var scrollerbackground = 'red';
// 공지사항 갯수
var num = 1;
// 멈추는 시간 클수록 오래 멈춤
var scrollspeed = '4000';
// Scrolling 속도
var waitingtime = '20';
var messages = new Array();
// if (messages.length > 1) {
// i = 1;
//} else {
// i = 0;
// }
i = 2
function move1(whichlayer){
tlayer = eval(whichlayer);
if (tlayer.top > 0 && tlayer.top <= num) {
tlayer.top = 0;
setTimeout("move1(tlayer)", scrollspeed);
setTimeout("move2(document.main.document.second)", scrollspeed);
return;
}
if (tlayer.top >= tlayer.document.height *- 1) {
tlayer.top -= num;
setTimeout("move1(tlayer)", waitingtime);
} else {
tlayer.top = scrollerheight;
tlayer.document.write(messages[i]);
tlayer.document.close();
if (i == messages.length-1) {
i=0;
} else {
i++;
}
}
}
function move2(whichlayer) {
tlayer2 = eval(whichlayer);
if (tlayer2.top > 0 && tlayer2.top <= num) {
tlayer2.top = 0;
setTimeout("move2(tlayer2)", scrollspeed);
setTimeout("move1(document.main.document.first)", scrollspeed);
return;
}
if (tlayer2.top >= tlayer2.document.height *- 1) {
tlayer2.top -= num;
setTimeout("move2(tlayer2)", waitingtime);
} else {
tlayer2.top = scrollerheight;
tlayer2.document.write(messages[i]);
tlayer2.document.close();
if (i==messages.length-1) {
i=0;
} else {
i++;
}
}
}
function move3(whichdiv) {
tdiv = eval(whichdiv);
if (tdiv.style.pixelTop > 0 && tdiv.style.pixelTop <= num){
tdiv.style.pixelTop = 0;
setTimeout("move3(tdiv)", scrollspeed);
setTimeout("move4(second2)",scrollspeed);
return;
}
if (tdiv.style.pixelTop >= tdiv.offsetHeight *- 1) {
tdiv.style.pixelTop -= num;
setTimeout("move3(tdiv)", waitingtime);
} else {
tdiv.style.pixelTop = scrollerheight;
tdiv.innerHTML = messages[i];
if (i == messages.length-1) {
i=0;
} else {
i++;
}
}
}
function move4(whichdiv) {
tdiv2 = eval(whichdiv);
if (tdiv2.style.pixelTop > 0 && tdiv2.style.pixelTop <= num) {
tdiv2.style.pixelTop = 0;
setTimeout("move4(tdiv2)", scrollspeed);
setTimeout("move3(first2)", scrollspeed);
return;
}
if (tdiv2.style.pixelTop >= tdiv2.offsetHeight *- 1) {
tdiv2.style.pixelTop -= num;
setTimeout("move4(second2)", waitingtime);
} else {
tdiv2.style.pixelTop = scrollerheight;
tdiv2.innerHTML = messages[i];
if (i == messages.length - 1) {
i=0;
} else {
i++;
}
}
}
function onmouse_event() {
num=0;
}
function mouseout_event() {
num=1;
}
function startscroll() {
if (document.all) {
move3(first2);
second2.style.top = scrollerheight;
second2.style.visibility = 'visible';
} else if (document.layers) {
document.main.visibility='show';
move1(document.main.document.first);
document.main.document.second.top = scrollerheight + num;
document.main.document.second.visibility = 'show';
}
}
window.onload = startscroll;
//-->
</script>
<!-- <?=$board[bo_subject]?> (<?=$board[bo_table]?>) 최신글 -->
<table width="95%" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<?
for ($i=0; $i<count($list); $i++)
{
$img = "<img src='$latest_skin_path/img/no_image.gif' border=0 title='이미지 없음'>";
$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
continue;
$rate = 100 / $size[0];
$height = (int)($size[1] * $rate);
if ($height < 75)
$dst = imagecreatetruecolor(100, $height);
else
$dst = imagecreatetruecolor(100, 75);
imagecopyresampled($dst, $src, 0, 0, 0, 0, 100, $height, $size[0], $size[1]);
imagepng($dst, $thumb_path.'/'.$list[$i][wr_id], $board[bo_9]);
chmod($thumb_path.'/'.$list[$i][wr_id], 0606);
}
}
if (file_exists($thumb))
$img = "<img src='$thumb' border=0>";
$href = "$g4[bbs_path]/board.php?bo_table=$bo_table";
$subject = "<span $style>".cut_str($list[$i][subject],1000)."</span>";
$wr_content = "<span $style>".cut_str(get_text($list[$i][wr_content]),$board[bo_7])."</span>";
$urlc = "$url?wr_id={$list[$i][wr_id]}"; // 경로지정 부분.....
?>
<script language="javascript">
msgtxt = "<table border='0'><tr><td width='2'> </td><td width='100' height='28' valign='top'>"
msgtxt = msgtxt + "<table border='1' width='95' height='90' cellspacing='0' cellpadding='0' bordercolor='#C0C0C0' bordercolorlight='#C0C0C0' bordercolordark='#FFFFFF'>"
msgtxt = msgtxt + "<tr><td width='100%' align='center' valign='middle'><img src='<?=$thumb?>' width='85' height='80'></td></tr></table>"
msgtxt = msgtxt + "</td><td width='170' height='110' valign='top'><b><font color=#808080><a href='<?= $urlc ?>'><?= $subject ?></font></b><br><font color=#808080><?= $wr_content ?><font></a></td></tr></table>"
messages[<?=$i?>] = msgtxt;
</script>
<? } ?>
<td valign="top" align="left">
<script language="JavaScript1.2">
if (document.all) {
document.writeln('<span id="main2" style="position:relative;width:'+scrollerwidth+';height:'+scrollerheight+';overflow:hiden;background-color:'+scrollerbgcolor+' ;background-image:url('+scrollerbackground+')">')
document.writeln('<div onMouseOver="onmouse_event()" onMouseOut="mouseout_event()" style="position:absolute;width:'+scrollerwidth+';height:'+scrollerheight+';clip:rect(0 '+scrollerwidth+' '+scrollerheight+' 0);left:0;top:1;z-index:1">')
document.writeln('<div id="first2" style="position:absolute;width:'+scrollerwidth+';left:0;top:1;z-index:1">')
document.write(messages[0])
document.writeln('</div>')
document.writeln('<div id="second2" style="position:absolute;width:'+scrollerwidth+';left:0;top:1;z-index:1; visibility:hidden">')
document.write(messages[1])
document.writeln('</div>')
document.writeln('</div>')
document.writeln('</span>')
}
</script>
</td>
</tr>
</table>
도데체 어느부분이 잘못된것인지 알수가 없네요 ㅠ.ㅠ
적용은 <?=latest("PhotoToday","게시판명", 5, 80) ?> 이런식으로 했고요..
게시판 생성시 해당 여분필드도 시키는 데로 만들었습니다.
현재 상태는 다음 링크와 같습니다. http://www.ebcaustralia.com
여기서 중간부분 오른쪽에 보시면 "undefined"란 글이 아래에서 위로 스크롤 되는 부분입니다.
원본 소스에서 특별히 변경한 부분은 테이블 사이즈 외엔 없구요..
다시 보니까 자바스크립트 에러도 나네요;;;;
급합니다. 고수님들 꼭 좀 도와주세요;;;
http://www.sir.co.kr/bbs/board.php?bo_table=g4_skin&wr_id=11339
위의 최신글 스킨을 적용하려고 합니다.
최신글 스킨 원본소스는 아래와 같습니다.
<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
if (!$board[bo_9]) alert("해당 게시판 설정 : 여분 필드 9 에 목록에서 보여질 이미지의 질(quality)을 비율로 설정하십시오. (100 이하)");
if (!$board[bo_7]) alert("게시판 설정 : 여분 필드 7 에 목록에서 내용길이를 입력하십시오.");
if (!function_exists("imagecopyresampled")) alert("GD 2.0.1 이상 버전이 설치되어 있어야 사용할 수 있는 스킨 입니다.");
$data_path = $g4[path]."/data/file/$bo_table";
$thumb_path = $data_path.'/thumb100';
@mkdir($thumb_path, 0707);
@chmod($thumb_path, 0707);
?>
<script language="JavaScript">
<!--
var scrollerwidth = 238;
var scrollerheight = 150;
var scrollerbgcolor = '';
var scrollerbackground = 'red';
// 공지사항 갯수
var num = 1;
// 멈추는 시간 클수록 오래 멈춤
var scrollspeed = '4000';
// Scrolling 속도
var waitingtime = '20';
var messages = new Array();
// if (messages.length > 1) {
// i = 1;
//} else {
// i = 0;
// }
i = 2
function move1(whichlayer){
tlayer = eval(whichlayer);
if (tlayer.top > 0 && tlayer.top <= num) {
tlayer.top = 0;
setTimeout("move1(tlayer)", scrollspeed);
setTimeout("move2(document.main.document.second)", scrollspeed);
return;
}
if (tlayer.top >= tlayer.document.height *- 1) {
tlayer.top -= num;
setTimeout("move1(tlayer)", waitingtime);
} else {
tlayer.top = scrollerheight;
tlayer.document.write(messages[i]);
tlayer.document.close();
if (i == messages.length-1) {
i=0;
} else {
i++;
}
}
}
function move2(whichlayer) {
tlayer2 = eval(whichlayer);
if (tlayer2.top > 0 && tlayer2.top <= num) {
tlayer2.top = 0;
setTimeout("move2(tlayer2)", scrollspeed);
setTimeout("move1(document.main.document.first)", scrollspeed);
return;
}
if (tlayer2.top >= tlayer2.document.height *- 1) {
tlayer2.top -= num;
setTimeout("move2(tlayer2)", waitingtime);
} else {
tlayer2.top = scrollerheight;
tlayer2.document.write(messages[i]);
tlayer2.document.close();
if (i==messages.length-1) {
i=0;
} else {
i++;
}
}
}
function move3(whichdiv) {
tdiv = eval(whichdiv);
if (tdiv.style.pixelTop > 0 && tdiv.style.pixelTop <= num){
tdiv.style.pixelTop = 0;
setTimeout("move3(tdiv)", scrollspeed);
setTimeout("move4(second2)",scrollspeed);
return;
}
if (tdiv.style.pixelTop >= tdiv.offsetHeight *- 1) {
tdiv.style.pixelTop -= num;
setTimeout("move3(tdiv)", waitingtime);
} else {
tdiv.style.pixelTop = scrollerheight;
tdiv.innerHTML = messages[i];
if (i == messages.length-1) {
i=0;
} else {
i++;
}
}
}
function move4(whichdiv) {
tdiv2 = eval(whichdiv);
if (tdiv2.style.pixelTop > 0 && tdiv2.style.pixelTop <= num) {
tdiv2.style.pixelTop = 0;
setTimeout("move4(tdiv2)", scrollspeed);
setTimeout("move3(first2)", scrollspeed);
return;
}
if (tdiv2.style.pixelTop >= tdiv2.offsetHeight *- 1) {
tdiv2.style.pixelTop -= num;
setTimeout("move4(second2)", waitingtime);
} else {
tdiv2.style.pixelTop = scrollerheight;
tdiv2.innerHTML = messages[i];
if (i == messages.length - 1) {
i=0;
} else {
i++;
}
}
}
function onmouse_event() {
num=0;
}
function mouseout_event() {
num=1;
}
function startscroll() {
if (document.all) {
move3(first2);
second2.style.top = scrollerheight;
second2.style.visibility = 'visible';
} else if (document.layers) {
document.main.visibility='show';
move1(document.main.document.first);
document.main.document.second.top = scrollerheight + num;
document.main.document.second.visibility = 'show';
}
}
window.onload = startscroll;
//-->
</script>
<!-- <?=$board[bo_subject]?> (<?=$board[bo_table]?>) 최신글 -->
<table width="95%" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<?
for ($i=0; $i<count($list); $i++)
{
$img = "<img src='$latest_skin_path/img/no_image.gif' border=0 title='이미지 없음'>";
$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
continue;
$rate = 100 / $size[0];
$height = (int)($size[1] * $rate);
if ($height < 75)
$dst = imagecreatetruecolor(100, $height);
else
$dst = imagecreatetruecolor(100, 75);
imagecopyresampled($dst, $src, 0, 0, 0, 0, 100, $height, $size[0], $size[1]);
imagepng($dst, $thumb_path.'/'.$list[$i][wr_id], $board[bo_9]);
chmod($thumb_path.'/'.$list[$i][wr_id], 0606);
}
}
if (file_exists($thumb))
$img = "<img src='$thumb' border=0>";
$href = "$g4[bbs_path]/board.php?bo_table=$bo_table";
$subject = "<span $style>".cut_str($list[$i][subject],1000)."</span>";
$wr_content = "<span $style>".cut_str(get_text($list[$i][wr_content]),$board[bo_7])."</span>";
$urlc = "$url?wr_id={$list[$i][wr_id]}"; // 경로지정 부분.....
?>
<script language="javascript">
msgtxt = "<table border='0'><tr><td width='2'> </td><td width='100' height='28' valign='top'>"
msgtxt = msgtxt + "<table border='1' width='95' height='90' cellspacing='0' cellpadding='0' bordercolor='#C0C0C0' bordercolorlight='#C0C0C0' bordercolordark='#FFFFFF'>"
msgtxt = msgtxt + "<tr><td width='100%' align='center' valign='middle'><img src='<?=$thumb?>' width='85' height='80'></td></tr></table>"
msgtxt = msgtxt + "</td><td width='170' height='110' valign='top'><b><font color=#808080><a href='<?= $urlc ?>'><?= $subject ?></font></b><br><font color=#808080><?= $wr_content ?><font></a></td></tr></table>"
messages[<?=$i?>] = msgtxt;
</script>
<? } ?>
<td valign="top" align="left">
<script language="JavaScript1.2">
if (document.all) {
document.writeln('<span id="main2" style="position:relative;width:'+scrollerwidth+';height:'+scrollerheight+';overflow:hiden;background-color:'+scrollerbgcolor+' ;background-image:url('+scrollerbackground+')">')
document.writeln('<div onMouseOver="onmouse_event()" onMouseOut="mouseout_event()" style="position:absolute;width:'+scrollerwidth+';height:'+scrollerheight+';clip:rect(0 '+scrollerwidth+' '+scrollerheight+' 0);left:0;top:1;z-index:1">')
document.writeln('<div id="first2" style="position:absolute;width:'+scrollerwidth+';left:0;top:1;z-index:1">')
document.write(messages[0])
document.writeln('</div>')
document.writeln('<div id="second2" style="position:absolute;width:'+scrollerwidth+';left:0;top:1;z-index:1; visibility:hidden">')
document.write(messages[1])
document.writeln('</div>')
document.writeln('</div>')
document.writeln('</span>')
}
</script>
</td>
</tr>
</table>
도데체 어느부분이 잘못된것인지 알수가 없네요 ㅠ.ㅠ
적용은 <?=latest("PhotoToday","게시판명", 5, 80) ?> 이런식으로 했고요..
게시판 생성시 해당 여분필드도 시키는 데로 만들었습니다.
현재 상태는 다음 링크와 같습니다. http://www.ebcaustralia.com
여기서 중간부분 오른쪽에 보시면 "undefined"란 글이 아래에서 위로 스크롤 되는 부분입니다.
원본 소스에서 특별히 변경한 부분은 테이블 사이즈 외엔 없구요..
다시 보니까 자바스크립트 에러도 나네요;;;;
급합니다. 고수님들 꼭 좀 도와주세요;;;
댓글 전체
^^ 스크롤 되는 게시물 제일 끝에 여백이 있는지 확인해보세요... 전 그거땜시 안되더라고용

음 윗분이 말씀하셨듯이 여백(공백)문자때문일 가능성이 높습니다.
$wr_content = "<span $style>".cut_str(get_text($list[$i][wr_content]),$board[bo_7])."</span>";
이부분을
$wr_content = cut_str(get_text($list[$i][wr_content]),50,"…");
$wr_content = cut_str(strip_tags($wr_content);
$wr_content = str_replace("\n", "", $wr_content);
$wr_content = str_replace("\r", "", $wr_content);
$wr_content = "<span $style>" . $wr_content . "</span>";
조금 복잡한듯 하지만 공백을 앞뒤공백을 제거한다고 생각하시면 됩니다.
$wr_content = "<span $style>".cut_str(get_text($list[$i][wr_content]),$board[bo_7])."</span>";
이부분을
$wr_content = cut_str(get_text($list[$i][wr_content]),50,"…");
$wr_content = cut_str(strip_tags($wr_content);
$wr_content = str_replace("\n", "", $wr_content);
$wr_content = str_replace("\r", "", $wr_content);
$wr_content = "<span $style>" . $wr_content . "</span>";
조금 복잡한듯 하지만 공백을 앞뒤공백을 제거한다고 생각하시면 됩니다.