클럽최신글 도와주세요
클럽을 사용중인데요. 클럽에서 동일한 메뉴의 글들만 최신글로 가져오려고 합니다.
그룹최신글 소스를(아래참조) 통해 가져왔으나, 추출된 최신글을 누르면 엉뚱한 클럽으로 이동이 됩니다. 어떻게 해야 할 지 난감합니다.
클럽최신글을 완전하게 가기를 보고 아무리 적용해도 마찬가지이구요.
도와주세요. 꼭 필요합니다.
그룹최신글
<?
if (!defined('_GNUBOARD_')) exit;
/// 함수 정의 시작
// --------- 동일한 그룹내에서 '검색이 지정된 게시판'중의 최신글만을 출력
// --------- 최신글 'group'폴더(임의의 폴더)와 연동
function tem_group_select($skin_dir="", $gr_id, $rows=10, $subject_len=40, $category="", $orderby="", $options="")
{
global $config;
global $g4;
$list = array();
$limitrows = $rows;
// 특정게시판 제외 출력
// $sqlgroup = " select bo_table, bo_subject from $g4[board_table] where gr_id = '$gr_id' and bo_table <> 'tmb_01b01' ";
// -- 방법4 (검색이 지정된 전체 게시판의 게시물 출력)
$sqlgroup = " select bo_table, bo_subject from $g4[board_table] where gr_id = '$gr_id' and bo_use_search=1 order by bo_order_search";
$rsgroup = sql_query($sqlgroup);
if ($skin_dir)
$latest_skin_path = "$g4[path]/skin/latest/$skin_dir";
else
$latest_skin_path = "$g4[path]/skin/latest/$config[cf_latest_skin]";
for ($j=0, $k=0; $rowgroup=sql_fetch_array($rsgroup); $j++) {
$bo_table = $rowgroup[bo_table];
// 테이블 이름구함
$sql = " select * from {$g4[board_table]} where bo_table = '$bo_table'";
$board = sql_fetch($sql);
$tmp_write_table = $g4[write_prefix] . $bo_table; // 게시판 테이블 실제이름
// 옵션에 따라 정렬
$sql = "select * from $tmp_write_table where wr_is_comment = 0 ";
$sql .= (!$category) ? "" : " and ca_name = '$category' ";
$sql .= (!$orderby) ? " order by wr_id desc " : " order by $orderby desc, wr_id desc ";
$sql .= " limit $limitrows";
$result = sql_query($sql);
for ($i=0; $row = sql_fetch_array($result); $i++, $k++) {
if(!$orderby) $op_list[$k] = $row[wr_datetime];
else {
$op_list[$k] = is_string($row[$orderby]) ? sprintf("%-256s", $row[$orderby]) : sprintf("%016d", $row[$orderby]);
$op_list[$k] .= $row[wr_datetime];
}
$list[$k] = get_list($row, $board, $latest_skin_path, $subject_len);
$list[$k][bo_table] = $board[bo_table];
$list[$k][bo_subject] = $board[bo_subject];
$list[$k][bo_wr_subject] = cut_str($board[bo_subject] . $list[$k][wr_subject], $subject_len);
}
}
if($k>0) array_multisort($op_list, SORT_DESC, $list);
if($k>$rows) array_splice($list, $rows);
ob_start();
include "$latest_skin_path/latest.skin.php";
$content = ob_get_contents();
ob_end_clean();
return $content;
}
/// 함수 정의 끝
최신글추출 스킨은 아래처럼 했습니다.(그누보드설치url은 정상적인 url로 넣었구요)
<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
if (!function_exists("imagecopyresampled")) alert("GD 2.0.1 이상 버전이 설치되어 있어야 사용할 수 있는 스킨 입니다.");
$img_w = 100; //썸네일 가로크기
$img_h = 80; //썸네일 세로크기
$img_q = 100; //퀼리티
$data_path = $g4[path]."/data/file/$bo_table";
$thumb_path = $data_path.'/thumb_100'; //썸네일 저장 폴더
@mkdir($thumb_path, 0707);
@chmod($thumb_path, 0707);
if (!$cb_id) {
$cb_id = $bo_table;
}
?>
<link rel='stylesheet' type='text/css' href='<?=$latest_skin_path?>/latest_style.css'>
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td style="width:<?=$img_w?>px; height:<?=$img_h?>px; border:1px solid #CCCCCC; padding:3 3 3 3px;">
<? for ($i=0; $i<count($list); $i++) { ?>
<? if ($i==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 = $img_w / $size[0];
$height = (int)($size[1] * $rate);
if ($height < $img_h)
$dst = imagecreatetruecolor($img_w, $img_h);
else
$dst = imagecreatetruecolor($img_w, $img_h);
imagecopyresampled($dst, $src, 0, 0, 0, 0, $img_w, $img_h, $size[0], $size[1]);
imagejpeg($dst, $thumb_path.'/'.$list[$k][wr_id], $img_q);
chmod($thumb_path.'/'.$list[$k][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[$k][subject],16)."</span>";
$wr_content = "<span $style>".cut_str(get_text($list[$k][wr_content]),$board[bo_7])."</span>";
?>
<!--<a href="<?=$list[$k][href]?>"><?=$img?></a>-->
<a href="$g4[path]/club/club_main.php?doc=그누보드설치URL/bbs/board.php?bo_table=$board[bo_table]&cb_id=$board[bo_table]&wr_id={$list[$k][wr_id]}&bbs_mode=#"><?=$img?></a>
<? } ?>
<? } ?>
<? } ?></td>
<td valign="top">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<? for ($k=0; $k<count($list); $k++) { ?>
<? if ($k <= '0') { ?>
<tr>
<td width="5"></td>
<td width="15" height="20" align="center">·</td>
<td height="20">
<?
echo $list[$k][icon_reply] . " ";
//echo "<a href='{$list[$k][href]}'>";
echo "<a href='$g4[path]/club/club_main.php?doc=그노보드설치url/bbs/board.php?bo_table=$board[bo_table]&cb_id=$board[bo_table]&wr_id={$list[$k][wr_id]}&bbs_mode=#'>";
//echo "<a href='$g4[club_url]/club/club_main.php?botable=1&cb_id=$row[bo_table]&wr_id=$row2[wr_id]&sca=$row2[ca_name]'>";
if ($list[$k][is_notice])
echo "<span class=la_sub_N_1>{$list[$k][subject]}</span>";
else
echo "<span class=la_sub_1>{$list[$k][subject]}</span>";
echo "</a>";
?></td> </tr>
<? } else { ?>
<tr>
<td width="5"></td>
<td width="15" height="20" align="center">·</td>
<td height="20">
<?
echo $list[$k][icon_reply] . " ";
//echo "<a href='{$list[$k][href]}'>"; ?cb_id=$cb[cb_id]&bo_table=$bo_table"; $g4[path]/club/club_main.php?doc=자신의 보드 설치 url/board.php?bo_table=$board[bo_table]&cb_id=$board[bo_table]&wr_id=$list[wr_id]"
echo "<a href='$g4[path]/club/club_main.php?doc=그노보드설치url/bbs/board.php?bo_table=$board[bo_table]&cb_id=$board[bo_table]&wr_id={$list[$k][wr_id]}&bbs_mode=#'>";
if ($list[$k][is_notice])
echo "<span class=la_sub_N>{$list[$k][subject]}</span>";
else
echo "<span class=la_sub>{$list[$k][subject]}</span>";
echo "</a>";
?></td> </tr>
<? } ?>
<? } ?>
</table></td>
</tr>
</table>
그룹최신글 소스를(아래참조) 통해 가져왔으나, 추출된 최신글을 누르면 엉뚱한 클럽으로 이동이 됩니다. 어떻게 해야 할 지 난감합니다.
클럽최신글을 완전하게 가기를 보고 아무리 적용해도 마찬가지이구요.
도와주세요. 꼭 필요합니다.
그룹최신글
<?
if (!defined('_GNUBOARD_')) exit;
/// 함수 정의 시작
// --------- 동일한 그룹내에서 '검색이 지정된 게시판'중의 최신글만을 출력
// --------- 최신글 'group'폴더(임의의 폴더)와 연동
function tem_group_select($skin_dir="", $gr_id, $rows=10, $subject_len=40, $category="", $orderby="", $options="")
{
global $config;
global $g4;
$list = array();
$limitrows = $rows;
// 특정게시판 제외 출력
// $sqlgroup = " select bo_table, bo_subject from $g4[board_table] where gr_id = '$gr_id' and bo_table <> 'tmb_01b01' ";
// -- 방법4 (검색이 지정된 전체 게시판의 게시물 출력)
$sqlgroup = " select bo_table, bo_subject from $g4[board_table] where gr_id = '$gr_id' and bo_use_search=1 order by bo_order_search";
$rsgroup = sql_query($sqlgroup);
if ($skin_dir)
$latest_skin_path = "$g4[path]/skin/latest/$skin_dir";
else
$latest_skin_path = "$g4[path]/skin/latest/$config[cf_latest_skin]";
for ($j=0, $k=0; $rowgroup=sql_fetch_array($rsgroup); $j++) {
$bo_table = $rowgroup[bo_table];
// 테이블 이름구함
$sql = " select * from {$g4[board_table]} where bo_table = '$bo_table'";
$board = sql_fetch($sql);
$tmp_write_table = $g4[write_prefix] . $bo_table; // 게시판 테이블 실제이름
// 옵션에 따라 정렬
$sql = "select * from $tmp_write_table where wr_is_comment = 0 ";
$sql .= (!$category) ? "" : " and ca_name = '$category' ";
$sql .= (!$orderby) ? " order by wr_id desc " : " order by $orderby desc, wr_id desc ";
$sql .= " limit $limitrows";
$result = sql_query($sql);
for ($i=0; $row = sql_fetch_array($result); $i++, $k++) {
if(!$orderby) $op_list[$k] = $row[wr_datetime];
else {
$op_list[$k] = is_string($row[$orderby]) ? sprintf("%-256s", $row[$orderby]) : sprintf("%016d", $row[$orderby]);
$op_list[$k] .= $row[wr_datetime];
}
$list[$k] = get_list($row, $board, $latest_skin_path, $subject_len);
$list[$k][bo_table] = $board[bo_table];
$list[$k][bo_subject] = $board[bo_subject];
$list[$k][bo_wr_subject] = cut_str($board[bo_subject] . $list[$k][wr_subject], $subject_len);
}
}
if($k>0) array_multisort($op_list, SORT_DESC, $list);
if($k>$rows) array_splice($list, $rows);
ob_start();
include "$latest_skin_path/latest.skin.php";
$content = ob_get_contents();
ob_end_clean();
return $content;
}
/// 함수 정의 끝
최신글추출 스킨은 아래처럼 했습니다.(그누보드설치url은 정상적인 url로 넣었구요)
<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
if (!function_exists("imagecopyresampled")) alert("GD 2.0.1 이상 버전이 설치되어 있어야 사용할 수 있는 스킨 입니다.");
$img_w = 100; //썸네일 가로크기
$img_h = 80; //썸네일 세로크기
$img_q = 100; //퀼리티
$data_path = $g4[path]."/data/file/$bo_table";
$thumb_path = $data_path.'/thumb_100'; //썸네일 저장 폴더
@mkdir($thumb_path, 0707);
@chmod($thumb_path, 0707);
if (!$cb_id) {
$cb_id = $bo_table;
}
?>
<link rel='stylesheet' type='text/css' href='<?=$latest_skin_path?>/latest_style.css'>
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td style="width:<?=$img_w?>px; height:<?=$img_h?>px; border:1px solid #CCCCCC; padding:3 3 3 3px;">
<? for ($i=0; $i<count($list); $i++) { ?>
<? if ($i==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 = $img_w / $size[0];
$height = (int)($size[1] * $rate);
if ($height < $img_h)
$dst = imagecreatetruecolor($img_w, $img_h);
else
$dst = imagecreatetruecolor($img_w, $img_h);
imagecopyresampled($dst, $src, 0, 0, 0, 0, $img_w, $img_h, $size[0], $size[1]);
imagejpeg($dst, $thumb_path.'/'.$list[$k][wr_id], $img_q);
chmod($thumb_path.'/'.$list[$k][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[$k][subject],16)."</span>";
$wr_content = "<span $style>".cut_str(get_text($list[$k][wr_content]),$board[bo_7])."</span>";
?>
<!--<a href="<?=$list[$k][href]?>"><?=$img?></a>-->
<a href="$g4[path]/club/club_main.php?doc=그누보드설치URL/bbs/board.php?bo_table=$board[bo_table]&cb_id=$board[bo_table]&wr_id={$list[$k][wr_id]}&bbs_mode=#"><?=$img?></a>
<? } ?>
<? } ?>
<? } ?></td>
<td valign="top">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<? for ($k=0; $k<count($list); $k++) { ?>
<? if ($k <= '0') { ?>
<tr>
<td width="5"></td>
<td width="15" height="20" align="center">·</td>
<td height="20">
<?
echo $list[$k][icon_reply] . " ";
//echo "<a href='{$list[$k][href]}'>";
echo "<a href='$g4[path]/club/club_main.php?doc=그노보드설치url/bbs/board.php?bo_table=$board[bo_table]&cb_id=$board[bo_table]&wr_id={$list[$k][wr_id]}&bbs_mode=#'>";
//echo "<a href='$g4[club_url]/club/club_main.php?botable=1&cb_id=$row[bo_table]&wr_id=$row2[wr_id]&sca=$row2[ca_name]'>";
if ($list[$k][is_notice])
echo "<span class=la_sub_N_1>{$list[$k][subject]}</span>";
else
echo "<span class=la_sub_1>{$list[$k][subject]}</span>";
echo "</a>";
?></td> </tr>
<? } else { ?>
<tr>
<td width="5"></td>
<td width="15" height="20" align="center">·</td>
<td height="20">
<?
echo $list[$k][icon_reply] . " ";
//echo "<a href='{$list[$k][href]}'>"; ?cb_id=$cb[cb_id]&bo_table=$bo_table"; $g4[path]/club/club_main.php?doc=자신의 보드 설치 url/board.php?bo_table=$board[bo_table]&cb_id=$board[bo_table]&wr_id=$list[wr_id]"
echo "<a href='$g4[path]/club/club_main.php?doc=그노보드설치url/bbs/board.php?bo_table=$board[bo_table]&cb_id=$board[bo_table]&wr_id={$list[$k][wr_id]}&bbs_mode=#'>";
if ($list[$k][is_notice])
echo "<span class=la_sub_N>{$list[$k][subject]}</span>";
else
echo "<span class=la_sub>{$list[$k][subject]}</span>";
echo "</a>";
?></td> </tr>
<? } ?>
<? } ?>
</table></td>
</tr>
</table>
|
댓글을 작성하시려면 로그인이 필요합니다.
로그인
댓글 5개
제가 올린 자료입니다.
내용을 살펴보면 금방 아실수 있을 것입니다.
성공하시길 바랍니다...^^
그런데, 위의 올려주신 스킨은 기존의 최신글 소스로는 불러올 수 없는 것이네요. 저는 카테고리별 최신글이 필요하거든요. 그것도 클럽전체에서 동일한 카테리만 불러와야 해서, 이렇게 복잡해졌습니다.
조금만 더 힌트를 주시면 안 될까요? 너무 답답합니다.
function tem_group_select(스킨, 그룹, 게시글 수, 제목 글자수, 카테고리, $orderby="", $options="")
다른 것들은 무엇을 의미하는 지 잘 모름....
여기에서 카테고리라함은 정확하게 무엇을 말씀하시는 것인가요?
그래서, 클럽의 메뉴관리에 가보면, 일반게시판,갤러리 형태의 메뉴들을 추가할 수 있고, 그것을 카테고리라고 표현한 것입니다. 저는 초기에 클럽이 생성될 때 기본적으로 만들어지는 메뉴를 설정했구요.
그래서, 클럽에서 동일한 메뉴들(그누보드카테고리)에 쓰여진 글들을 club_main.php 가 아니라, 홈페이지 처음에 최신글로 나타내거나, 별도의 메인 페이지를 만들어서 최신글로 나타내려고 하는것이거든요.
그래서, 위에 있는 소스들을 사용한 것입니다. 글들은 잘 추출이 됩니다. 그런데, 해당글을 클릭하면, 없는 클럽이라고 나옵니다. 링크가 잘 안되는 것입니다.
에궁. 설명이 되었나 모르겠습니다. 복잡하기만 합니다.