그누4스킨을 그누5로 변경 가능할까요?
본문
그누보드4에서 사용하고 있는 스킨인데요.
그누보드5에서 사용을 하려고 하는데
어떤것을 어떻게 바꿔야할지를 모르겠네요....
다른 분들께서 친절하게도 설명 해 놓은신 답변이 있는것 같기는 한데...
제가 초보이다보니 들어도 잘 이해가 되지를 않더라구요... ㅠ ㅠ
도움 좀 받을 수 있을까요? ㅠ ㅠ
변경해야할 소스는 3가지인것 같은데요...
아래 소스는 그누보드4입니다.
변경해야할 소스 1.=================================================================
<?
function latest_rank($skin_dir="", $bo_table, $rows=10, $subject_len=40, $field="wr_link1_hit")
{
global $g4;
if ($skin_dir)
$latest_skin_path = "$g4[path]/skin/latest/$skin_dir";
else
$latest_skin_path = "$g4[path]/skin/latest/basic";
$sql = " select * from $g4[board_table] where bo_table = '$bo_table'";
$board = sql_fetch($sql);
$list = array();
$rankinfo = array();
switch($field) {
case "wr_link1_hit":
$rankinfo = array("bo_subj"=>"bo_1_subj", "date"=>$board[bo_1_subj], "wr_no"=>"wr_1"); break;
case "wr_link2_hit":
$rankinfo = array("bo_subj"=>"bo_2_subj", "date"=>$board[bo_2_subj], "wr_no"=>"wr_2"); break;
case "wr_hit":
$rankinfo = array("bo_subj"=>"bo_3_subj", "date"=>$board[bo_3_subj], "wr_no"=>"wr_3"); break;
case "wr_good":
$rankinfo = array("bo_subj"=>"bo_4_subj", "date"=>$board[bo_4_subj], "wr_no"=>"wr_4"); break;
case "wr_nogood":
$rankinfo = array("bo_subj"=>"bo_5_subj", "date"=>$board[bo_5_subj], "wr_no"=>"wr_5"); break;
default:
return "<span style='font-size:12px'>$field 필드는 사용하실 수 없습니다. <br> 사용가능한 필드명을 확인하시기 바랍니다.</span>";
}
// 설정
$m3_cron[ori_ymd] = $rankinfo['date'];
$m3_cron[path] = "$latest_skin_path/m3cron";
$m3_cron[ymd] = date("Y-m-d");
$m3_cron[m] = date("m");
$m3_cron[w] = date("D");
$m3_cron[d] = date("d");
$m3_cron[ori_m] = substr($m3_cron[ori_ymd], 5, 2);
$m3_cron[ori_w] = date("D", strtotime($m3_cron[ori_ymd]));
$m3_cron[ori_d] = substr($m3_cron[ori_ymd], -2);
$m3_cron[field] = $field;
$str_notice = str_replace("\n", ",", trim($board[bo_notice]));
if ($str_notice) $str_notice = " and wr_id not in (" . $str_notice . ") ";
$tmp_write_table = $g4['write_prefix'] . $bo_table; // 게시판 테이블 전체이름
$sql = " select * from $tmp_write_table where wr_is_comment=0 $str_notice order by $field desc limit 0, $rows ";
$result = sql_query($sql);
for ($i=0; $row = sql_fetch_array($result); $i++)
$list[$i] = get_list($row, $board, $latest_skin_path, $subject_len);
ob_start();
include "$latest_skin_path/latest.skin.php";
$content = ob_get_contents();
ob_end_clean();
return $content;
}
?>
변경해야할 소스 2.=================================================================
<?php
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
if (!function_exists("imagecopyresampled")) alert("GD 2.0.1 이상 버전이 설치되어 있어야 사용할 수 있습니다.");
include_once "$latest_skin_path/m3cron.extend.php";
$img_width = '130'; //썸네일 가로길이
$img_height = '80'; //썸네일 세로길이
$img_quality = '100'; //퀼리티 100이하로 설정
$data_path = $g4[path]."/data/file/$bo_table";
$thumb_path = $data_path.'/thumb'; //썸네일 이미지 생성 디렉토리
@mkdir($thumb_path, 0707);
@chmod($thumb_path, 0707);
$latest_subject = $board[bo_subject];// 제목
// 오늘이 아니면 날짜 업데이트 해놓고 이하 실행
if($m3_cron[ori_ymd] != $m3_cron[ymd]) {
sql_query("update $g4[board_table] set $rankinfo[bo_subj] = '$m3_cron[ymd]' where bo_table='$bo_table' ");
rank_update($bo_table, $field, $rankinfo);
}
?>
<style type="text/css">
#latest_rank td {
text-overflow:ellipsis;overflow:hidden;white-space:nowrap;font-size:11px;font-family:돋움;
}
#latest_rank a:link, a:visited, a:active { text-decoration:none; }
#latest_rank a:hover { text-decoration:none; }
.lank_line { border-top:2px solid #333333; border-bottom:1px solid #CCCCCC; text-align:center; font-weight:bold; background-image:url(<?=$latest_skin_path?>/img/lank_bg.gif); height:32px; padding-left:3px; }
.style1 {
color: #0000FF;
font-weight: bold;
}
</style>
<script type="text/javascript" src="<?=$g4['path']?>/js/common.js"></script>
<div style="height:46px;">
<img src="<?=$latest_skin_path?>/img/rank_title.gif" border="0" align="absmiddle"></a></div>
<table width=100% cellpadding=0 cellspacing=0 align="center">
<tr>
<td align=center style="BORDER-BOTTOM:1px solid #ebebeb; OVERFLOW: hidden">
<table width=100% align="center" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="110" valign="middle" class="lank_line">평가순위</td>
<td width="150" valign="middle" class="lank_line">이미지</td>
<td valign="middle" class="lank_line">세부정보</td>
<td width="150" class="lank_line">클릭수</td>
<td width="50" valign="middle" class="lank_line">등락</td>
<tr>
<? for ($i=0; $i<count($list); $i++) {
//썸네일 생성
$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);
}
}
if (file_exists($thumb))
$thumfile = "<img src='$thumb' width='{$img_width}' height='{$img_height}' border='0' style='border:5 #eee solid' onmouseover=this.style.filter='alpha(opacity=60)' onmouseout=this.style.filter='' title='{$list[$i][subject]}'></a>";
else
//이미지가 없으면
$thumfile="<img src='$latest_skin_path/img/noimg.gif' width='{$img_width}' height='{$img_height}' style='border:1 #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>"; }
?>
<tr>
<td height="110" valign="middle" align="center" style="BORDER-BOTTOM:1px solid #ebebeb;">
<span style="color:#FF0000; font-size:15px; font-weight:bold;"><strong>
<?=$i+1;?> 위
</strong></span></td>
<td valign="middle" style="BORDER-BOTTOM:1px solid #ebebeb;">
<a href='<?=$list[$i][href]?>' target=_self><?=$thumfile?></a>
</td>
<td align="left" width="520" valign="middle" style="BORDER-BOTTOM:1px solid #ebebeb; font-size:15px; padding-left:20px; word-break:break-all; ">
<div style=" margin-bottom:10px;">
<? switch($m3_cron[field]) {
case "wr_hit":
$link = "<img src='{$latest_skin_path}/img/rank_home_btn.gif' align='absmiddle'> <a href='{$list[$i][link_href][1]}' target=_blank><span style='color:#032db4; font-weight:bold;'>{$list[$i][wr_subject]}</span></a>";
break;
case "wr_hit":
$link = "<img src='{$latest_skin_path}/img/rank_home_btn.gif' align='absmiddle'> <a href='{$list[$i][link_href][2]}' target=_blank><span style='color:#032db4; font-weight:bold;'>{$list[$i][wr_subject]}</span></a>";
break;
case "wr_hit":
case "wr_good":
case "wr_nogood":
$link = "<img src='{$latest_skin_path}/img/rank_home_btn.gif' align='absmiddle'> <a href='{$list[$i][href]}'><span style='color:#032db40; font-weight:bold;'>{$list[$i][subject]}</span></a>";
break;
default:
$link = "필드를 찾을 수 없습니다.";
}
echo $link;
?>
</div>
<div><a href="<?=$list[$i][href]?>">
<span style="font-size:12px; font-family:돋움; word-break:break-all; display:block; letter-spacing:-1px; line-height:14px; color:#666666; clear:both;"><?=cut_str(strip_tags($list[$i][wr_content]),250,"...")?></span>
</div>
<div style="padding-top:5px; font-size:15px; color:#009900;"><a href="<?=$list[$i][link_href][1]?>" target=_blank><span style="color:#009900;"><strong><?=cut_str($list[$i][wr_link1], 35)?></strong></span></a></div>
</td>
<td style="BORDER-BOTTOM:1px solid #ebebeb;" align="center">
<img src="<?=$latest_skin_path?>/img/site_click.gif" align="absmiddle"><br />
<span style="color:#ff0000; font-size:14px; font-weight:bold;"><?=$list[$i][wr_hit]?></span>
</td>
<td align=right style="font-family:돋움;font-size:17px;color:gray; BORDER-BOTTOM:1px solid #ebebeb; padding-right:14px; font-weight:bold;">
<?
if (!empty($list[$i][$rankinfo[wr_no]])) //어제 순위가 있다면
$ratio = $list[$i][$rankinfo[wr_no]] - ($i+1);
else
$ratio = 0; // 어제 순위가 없다면 오늘 순위
echo $ratio . " ";
if ($ratio > 0)
echo "<img src='$latest_skin_path/img/up.gif'>";
else if ($ratio < 0)
echo "<img src='$latest_skin_path/img/down.gif'>";
else
echo "<img src='$latest_skin_path/img/zero.gif'>";
//echo " hit: " . $list[$i][$field];
//echo " ye: " . $list[$i][wr_1];
//echo " to: " . ($i+1);
?></td>
</tr>
<? } ?>
</table>
</td>
</tr>
<? if (count($list) == 0) { ?><tr><td align=center height=50><font color=#6A6A6A>게시물이 없습니다.</a></td></tr><? } ?>
</table>
</div>
변경해야할 소스 3.=================================================================
<?
function rank_update($bo_table, $field, $rankinfo) {
global $g4;
$tmp_write_table = $g4['write_prefix'] . $bo_table; // 게시판 테이블 전체이름
$sql = " select wr_id from $tmp_write_table where wr_is_comment = 0 order by $field desc ";
$result = sql_query($sql);
for ($i=0; $row = sql_fetch_array($result); $i++) {
$sql = "update $tmp_write_table set $rankinfo[wr_no] = '" . ($i+1) . "' where wr_id=".$row[wr_id];
sql_query($sql);
}
}
?>
!-->!-->!-->!-->
답변을 작성하시기 전에 로그인 해주세요.