최근게시물클릭시 해당 게시물의 링크로 바로 연결시키는방법? 정보
최근게시물클릭시 해당 게시물의 링크로 바로 연결시키는방법?
본문
안녕하세요~ ^^
최근게시물 스킨들을 보다보면 랜덤배너스킨들 같은 경우엔 클릭시
해당 게시물에 걸려있는 링크1의 주소로 바로 이동이 됩니다.
제가 현재 탭최근게시물을 사용중인데요.
이것도 랜덤배너스킨 처럼 클릭하면 해당 게시물로 이동되는게 아니라
해당 게시물에 적어놓은 링크1의 주소로 바로 연결을 시키고 싶습니다.
근데.. 쌩초보인지라.. 아무리 소스를 봐도 어디를 수정해야 할지 모르겠습니다. ^^;
아래는 해당 탭형 최근게시물 소스입니다.
<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
$img_width = 650;
$img_height = 210;
$img_quality = 100;
if (!function_exists("imagecopyresampled")) alert("GD 2.0.1 이상 버전이 설치되어 있어야 사용할 수 있는 갤러리 게시판 입니다.");
$data_path = $g4[path]."/data/file/$bo_table";
$thumb_path = $data_path.'/thumb_G7';
$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_G7='1';
function ComeonG7(objid_G7){
document.getElementById("debate_G7"+old_debate_G7).style.display="none";
document.getElementById("debate_G7"+old_debate_G7+"#1").style.display="";
document.getElementById("debate_G7"+objid_G7+"#1").style.display="none";
document.getElementById("debate_G7"+objid_G7).style.display="";
document.getElementById("debate_content_G7"+old_debate_G7).style.display="none";
document.getElementById("debate_content_G7"+objid_G7).style.display="";
old_debate_G7=objid_G7;
}
var objid_G7 = 1;
var interval_best;
function best_changeG7()
{
if( objid_G7 == <?=count($list)?> ) // 드렁크수달수님 팁
objid_G7 = 1;
else
objid_G7++;
ComeonG7(objid_G7);
}
function setInterval_best()
{
interval_best = setInterval("best_changeG7()",5000);//속도조절
}
function clearInterval_best()
{
clearInterval(interval_best);
}
setInterval_best();
//-->
</SCRIPT>
<!-- 본문 시작 -->
<table width="671" border="0" align="center" cellpadding="0" cellspacing="0">
<tr><td>
<? for ($i=0; $i<count($list); $i++) {
$j = $i + 1;
if ($j == "1") {
echo "<DIV>";
echo "<DIV id=debate_content_G7$j onmouseover=clearInterval_best() onmouseout=setInterval_best()>"; }
else { echo "<DIV id=debate_content_G7$j onmouseover=clearInterval_best() onmouseout=setInterval_best() style='DISPLAY: none;'>\n"; }
?>
<style type="text/css">
ul, li { list-style:none; margin:0; padding:0;}
#ifocusQ { width:650px; height:210px; margin:0px; border:0px }
#ifocusQ_img { display:inline; position:relative; float:left; width:650px; height:210px; border:0px; overflow:hidden; }
#ifocusQ_imglist { position:absolute; }
#ifocusQ_imglist li { width:650px; height:210px; overflow:hidden; }
#ifocusQ_imglist img { width:650px; height:210px;}
#ifocusQ_ico { display:inline; float:center; width:1px;}
#ifocusQ_ico li { width:10px; height:46px; cursor:pointer; opacity:0.5; -moz-opacity:0.5; filter:alpha(opacity=40); }
#ifocusQ_ico img { width:650px; height:210px; }
/*#ifocusQ_ico .current { background: url('<?=$latest_skin_path?>/image/ifocus_ico_bg.gif') no-repeat; opacity:1; -moz-opacity:1; filter:alpha(opacity=40); }*/
#ifocusQ_subjbar { position:absolute; left:0; bottom:0; width:650px; height:46px; background:#000; opacity:0.4; -moz-opacity:0.5; filter:alpha(opacity=40); }
#ifocusQ_subject { position:absolute; left:8px; bottom:7px; color:#FFFFFF;}
#ifocusQ_subject .normal { display:none; }
.date {font-family:Tahoma; font-size:9px; color:#e3c191; padding-bottom:3px;}
</style>
<table width="100%" border="0" cellspacing="0" cellpadding="0" align="center">
<tr><td>
<?
//썸네일 생성
$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/cheditor4/{$ym}/[^<>]*\.(gif|jpg|png|bmp)", $edit_img, $tmp)) { // data/geditor------
$file = './' . $tmp[0]; // 파일명
$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:1px #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>"; }
?>
<div id="ifocusQ">
<div id="ifocusQ_img">
<div id="ifocusQ_imglist" style="left:0; top:0;">
<div id="ifocusQ_subjbar"></div>
<div id="ifocusQ_subject">
<strong><?=$list[$i]['subject']?></strong><br>
<span class='date'>
<?=$list[$i]['datetime']?> By.<?=$list[$i]['wr_name']?></span>
</div>
<div id="ifocusQ_ico">
<a href='<?=$list[$i][href]?>'><?=$thumfile?></a>
</div></div></div></div>
</td>
</tr>
</table>
<?
echo "</DIV>";
}
?>
<td valign="top">
<? for ($i=0; $i<count($list); $i++) {
$k = $i + 1;
?>
<a href="<?=$list[$i][href]?>" onmouseover="javascript:ComeonG7('<?=$k?>')"><img src="<?=$latest_skin_path?>/img/<?=$k?>_on.gif" width="25" height="17" hspace="0" border="0" alt="<?=$list[$i][subject]?>" id="debate_G7<?=$k?>" onmouseover="clearInterval_best()" onmouseout="setInterval_best()" <? if($k == "1") { echo ""; } else { echo "style='DISPLAY: none;' "; } ?>>
<img src="<?=$latest_skin_path?>/img/<?=$k?>.gif" width="25" height="17" hspace="0" border="0" id="debate_G7<?=$k?>#1" <? if($k == "1") { echo "style='DISPLAY: none;'"; } else { echo ""; } ?>></a>
<?}?>
</td>
</tr>
</table>
소스 볼줄을 모르니 정말 힘이 듭니다.. ㅜ.ㅜ
지금 현재 C언어 책을 보고 있는데, C언어 어느정도 마스터가 되면 PHP도 빨리
공부 하고 싶네요 ㅜ.ㅜ
최근게시물 스킨들을 보다보면 랜덤배너스킨들 같은 경우엔 클릭시
해당 게시물에 걸려있는 링크1의 주소로 바로 이동이 됩니다.
제가 현재 탭최근게시물을 사용중인데요.
이것도 랜덤배너스킨 처럼 클릭하면 해당 게시물로 이동되는게 아니라
해당 게시물에 적어놓은 링크1의 주소로 바로 연결을 시키고 싶습니다.
근데.. 쌩초보인지라.. 아무리 소스를 봐도 어디를 수정해야 할지 모르겠습니다. ^^;
아래는 해당 탭형 최근게시물 소스입니다.
<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
$img_width = 650;
$img_height = 210;
$img_quality = 100;
if (!function_exists("imagecopyresampled")) alert("GD 2.0.1 이상 버전이 설치되어 있어야 사용할 수 있는 갤러리 게시판 입니다.");
$data_path = $g4[path]."/data/file/$bo_table";
$thumb_path = $data_path.'/thumb_G7';
$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_G7='1';
function ComeonG7(objid_G7){
document.getElementById("debate_G7"+old_debate_G7).style.display="none";
document.getElementById("debate_G7"+old_debate_G7+"#1").style.display="";
document.getElementById("debate_G7"+objid_G7+"#1").style.display="none";
document.getElementById("debate_G7"+objid_G7).style.display="";
document.getElementById("debate_content_G7"+old_debate_G7).style.display="none";
document.getElementById("debate_content_G7"+objid_G7).style.display="";
old_debate_G7=objid_G7;
}
var objid_G7 = 1;
var interval_best;
function best_changeG7()
{
if( objid_G7 == <?=count($list)?> ) // 드렁크수달수님 팁
objid_G7 = 1;
else
objid_G7++;
ComeonG7(objid_G7);
}
function setInterval_best()
{
interval_best = setInterval("best_changeG7()",5000);//속도조절
}
function clearInterval_best()
{
clearInterval(interval_best);
}
setInterval_best();
//-->
</SCRIPT>
<!-- 본문 시작 -->
<table width="671" border="0" align="center" cellpadding="0" cellspacing="0">
<tr><td>
<? for ($i=0; $i<count($list); $i++) {
$j = $i + 1;
if ($j == "1") {
echo "<DIV>";
echo "<DIV id=debate_content_G7$j onmouseover=clearInterval_best() onmouseout=setInterval_best()>"; }
else { echo "<DIV id=debate_content_G7$j onmouseover=clearInterval_best() onmouseout=setInterval_best() style='DISPLAY: none;'>\n"; }
?>
<style type="text/css">
ul, li { list-style:none; margin:0; padding:0;}
#ifocusQ { width:650px; height:210px; margin:0px; border:0px }
#ifocusQ_img { display:inline; position:relative; float:left; width:650px; height:210px; border:0px; overflow:hidden; }
#ifocusQ_imglist { position:absolute; }
#ifocusQ_imglist li { width:650px; height:210px; overflow:hidden; }
#ifocusQ_imglist img { width:650px; height:210px;}
#ifocusQ_ico { display:inline; float:center; width:1px;}
#ifocusQ_ico li { width:10px; height:46px; cursor:pointer; opacity:0.5; -moz-opacity:0.5; filter:alpha(opacity=40); }
#ifocusQ_ico img { width:650px; height:210px; }
/*#ifocusQ_ico .current { background: url('<?=$latest_skin_path?>/image/ifocus_ico_bg.gif') no-repeat; opacity:1; -moz-opacity:1; filter:alpha(opacity=40); }*/
#ifocusQ_subjbar { position:absolute; left:0; bottom:0; width:650px; height:46px; background:#000; opacity:0.4; -moz-opacity:0.5; filter:alpha(opacity=40); }
#ifocusQ_subject { position:absolute; left:8px; bottom:7px; color:#FFFFFF;}
#ifocusQ_subject .normal { display:none; }
.date {font-family:Tahoma; font-size:9px; color:#e3c191; padding-bottom:3px;}
</style>
<table width="100%" border="0" cellspacing="0" cellpadding="0" align="center">
<tr><td>
<?
//썸네일 생성
$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/cheditor4/{$ym}/[^<>]*\.(gif|jpg|png|bmp)", $edit_img, $tmp)) { // data/geditor------
$file = './' . $tmp[0]; // 파일명
$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:1px #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>"; }
?>
<div id="ifocusQ">
<div id="ifocusQ_img">
<div id="ifocusQ_imglist" style="left:0; top:0;">
<div id="ifocusQ_subjbar"></div>
<div id="ifocusQ_subject">
<strong><?=$list[$i]['subject']?></strong><br>
<span class='date'>
<?=$list[$i]['datetime']?> By.<?=$list[$i]['wr_name']?></span>
</div>
<div id="ifocusQ_ico">
<a href='<?=$list[$i][href]?>'><?=$thumfile?></a>
</div></div></div></div>
</td>
</tr>
</table>
<?
echo "</DIV>";
}
?>
<td valign="top">
<? for ($i=0; $i<count($list); $i++) {
$k = $i + 1;
?>
<a href="<?=$list[$i][href]?>" onmouseover="javascript:ComeonG7('<?=$k?>')"><img src="<?=$latest_skin_path?>/img/<?=$k?>_on.gif" width="25" height="17" hspace="0" border="0" alt="<?=$list[$i][subject]?>" id="debate_G7<?=$k?>" onmouseover="clearInterval_best()" onmouseout="setInterval_best()" <? if($k == "1") { echo ""; } else { echo "style='DISPLAY: none;' "; } ?>>
<img src="<?=$latest_skin_path?>/img/<?=$k?>.gif" width="25" height="17" hspace="0" border="0" id="debate_G7<?=$k?>#1" <? if($k == "1") { echo "style='DISPLAY: none;'"; } else { echo ""; } ?>></a>
<?}?>
</td>
</tr>
</table>
소스 볼줄을 모르니 정말 힘이 듭니다.. ㅜ.ㅜ
지금 현재 C언어 책을 보고 있는데, C언어 어느정도 마스터가 되면 PHP도 빨리
공부 하고 싶네요 ㅜ.ㅜ
댓글 전체
소스를 보는건 시간이 좀 걸려서
간단히 설명드리면
링크 $list[i$][href] 를 교체하세요.
link.php?bo_table=<?=$bo_table?>&wr_id=<?=$list[$i][wr_id]?>&no=1 이걸로
당연히 target도 고치세요 _blank로
간단히 설명드리면
링크 $list[i$][href] 를 교체하세요.
link.php?bo_table=<?=$bo_table?>&wr_id=<?=$list[$i][wr_id]?>&no=1 이걸로
당연히 target도 고치세요 _blank로
자루스님 답변감사드립니다 ^^
알려주신 답변대로 했는데.. 안되더군요.. 혼자 이리저리 알아보다가..
안되는데로 일단 쓰기로 했습니다... ㅠ.ㅠ
다른 방법을 찾을때까진 안되는데로 써야 하나 봅니다ㅏ.. ㅠ.ㅠ
알려주신 답변대로 했는데.. 안되더군요.. 혼자 이리저리 알아보다가..
안되는데로 일단 쓰기로 했습니다... ㅠ.ㅠ
다른 방법을 찾을때까진 안되는데로 써야 하나 봅니다ㅏ.. ㅠ.ㅠ
도움되는 정보 감사합니다.