그룹 최신게시물의 썸네일 출력이 안됩니다. 정보
그룹 최신게시물의 썸네일 출력이 안됩니다.본문
특정 그룹에서 wr_9필드에 '0'이 입력된 게시물만 최근게시물로 뽑으려고 합니다.
그리고 첫번째 게시물만 썸네일과 함께 제목, 내용이 출력되고,
이후부터는 제목만 출력되도록 했습니다.
그리고 첫번째 게시물만 썸네일과 함께 제목, 내용이 출력되고,
이후부터는 제목만 출력되도록 했습니다.
latest스킨에서 빨강색으로 표시한 부분에서 에러가 납니다.(썸네일 디렉토리 퍼미션 주는 부분)
그리고 썸네일 이미지가 안나오는데 어찌해야 할까요?
조언 부탁드립니다.
조언 부탁드립니다.
latest 스킨
----------------------------------------
<? if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
?>
<style>
.title a:link {font-family:돋움; font-size:12pt; color:#FFFFFF; text-decoration:none;}
.title a:visited {font-family:돋움; font-size:12pt; color:#FFFFFF; text-decoration:none;}
.title a:active {font-family:돋움; font-size:12pt; color:#FFFFFF; text-decoration:none;}
.title a:hover {font-family:돋움; font-size:12pt; color:#FFEA78; text-decoration:none;}
</style>
----------------------------------------
<? if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
?>
<style>
.title a:link {font-family:돋움; font-size:12pt; color:#FFFFFF; text-decoration:none;}
.title a:visited {font-family:돋움; font-size:12pt; color:#FFFFFF; text-decoration:none;}
.title a:active {font-family:돋움; font-size:12pt; color:#FFFFFF; text-decoration:none;}
.title a:hover {font-family:돋움; font-size:12pt; color:#FFEA78; text-decoration:none;}
</style>
<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
<TR>
<TD>
<TR>
<TD>
<?
$j=0;
for ($i=0; $i<count($list); $i++) {
$date = explode("-", $list[$i][date]);
$month = $date[1];
$day = $date[2];
$latest_date = $month."/".$day;
$j=0;
for ($i=0; $i<count($list); $i++) {
$date = explode("-", $list[$i][date]);
$month = $date[1];
$day = $date[2];
$latest_date = $month."/".$day;
//섬네일 관련 설정
for ($i=0; $i<count($list); $i++) {
if ($list[$i]['wr_9'] == '0') { // 헤드라인을 위한 wr_9필드 비교
$thumb1_width=120;//섬네일 최대폭
$thumb1_height=120;//섬네일 최대높이
$image = urlencode($list[$i][file][0][file]); // 첫번째 파일이 이미지라면
if (preg_match("/\.(gif|jpg|png)$/i", $image)) {
if(!is_file('$g4[path]/data/file/$bo_table/thumb1_$image')){
include "$g4[path]/thumbEngine/dq_thumb_engine2.php";
$thumbsource="$g4[path]/data/file/$bo_table/" . $image;
$thumbimg="$g4[path]/data/file/$bo_table/thumb1_" . $image;
make_thumb($thumb1_width,$thumb1_height,$thumbsource,$thumbimg);
chmod($thumbimg, 0606); //에러나는 부분
}
}
for ($i=0; $i<count($list); $i++) {
if ($list[$i]['wr_9'] == '0') { // 헤드라인을 위한 wr_9필드 비교
$thumb1_width=120;//섬네일 최대폭
$thumb1_height=120;//섬네일 최대높이
$image = urlencode($list[$i][file][0][file]); // 첫번째 파일이 이미지라면
if (preg_match("/\.(gif|jpg|png)$/i", $image)) {
if(!is_file('$g4[path]/data/file/$bo_table/thumb1_$image')){
include "$g4[path]/thumbEngine/dq_thumb_engine2.php";
$thumbsource="$g4[path]/data/file/$bo_table/" . $image;
$thumbimg="$g4[path]/data/file/$bo_table/thumb1_" . $image;
make_thumb($thumb1_width,$thumb1_height,$thumbsource,$thumbimg);
chmod($thumbimg, 0606); //에러나는 부분
}
}
if($list[$i][comment_cnt]) {
$comment_cnt ="<a href=\"javascript:{$list[$i][comment_href]}\">{$list[$i][comment_cnt]}</a>";
}
if ($j==0) { //// 첫번째 글 (제목 + 쪽글)
if(!$list[$i][file][0][file]){
$comment_cnt ="<a href=\"javascript:{$list[$i][comment_href]}\">{$list[$i][comment_cnt]}</a>";
}
if ($j==0) { //// 첫번째 글 (제목 + 쪽글)
if(!$list[$i][file][0][file]){
$wr_content = "<a href='{$list[$i][href]}'>".Shorten_String(strip_tags($list[$i][wr_content]), 260, '...')."</a>";//본문 글 줄이는 함수
//$wr_content=get_text($wr_content);
$line_shadow = "<tr><td height=1 background='{$latest_skin_path}/img/new/line_shadow01.gif'></td></tr>";
//$wr_content=get_text($wr_content);
$line_shadow = "<tr><td height=1 background='{$latest_skin_path}/img/new/line_shadow01.gif'></td></tr>";
echo <<<HEREDOC
<TABLE WIDTH="100%" BORDER="0" ALIGN="CENTER" CELLPADDING="0" CELLSPACING="0">
<TR>
<TD WIDTH="100%" ALIGN="LEFT" VALIGN="TOP"><TABLE WIDTH='100%' BORDER='0' CELLSPACING='0' CELLPADDING='2'>
<TR>
<TD VALIGN="bottom" style="padding-top:7;"><a href="{$list[$i][href]}"><b><span style="font-size:16pt;">{$list[$i][subject]}</span></b></a>
</TD>
</TR>
<TR>
<TD VALIGN="bottom" style="padding-top:7;"> <a href="{$list[$i][href]}"><b><span style="font-size:12pt;">{$list[$i][wr_1]}</span></b></a>
</TD>
</TR>
<TR>
<TD VALIGN="TOP"><div align="justify" style="margin-right:1; margin-left:1;"><a href="{$list[$i][href]}"><span style="font-size:11pt;"><font face="돋움">$wr_content</font></span></a></DIV></TD>
</TR>
</TABLE></TD>
</TR>
<TR>
<TD HEIGHT="3"></TD>
</TR>
</TABLE>
HEREDOC;
<TABLE WIDTH="100%" BORDER="0" ALIGN="CENTER" CELLPADDING="0" CELLSPACING="0">
<TR>
<TD WIDTH="100%" ALIGN="LEFT" VALIGN="TOP"><TABLE WIDTH='100%' BORDER='0' CELLSPACING='0' CELLPADDING='2'>
<TR>
<TD VALIGN="bottom" style="padding-top:7;"><a href="{$list[$i][href]}"><b><span style="font-size:16pt;">{$list[$i][subject]}</span></b></a>
</TD>
</TR>
<TR>
<TD VALIGN="bottom" style="padding-top:7;"> <a href="{$list[$i][href]}"><b><span style="font-size:12pt;">{$list[$i][wr_1]}</span></b></a>
</TD>
</TR>
<TR>
<TD VALIGN="TOP"><div align="justify" style="margin-right:1; margin-left:1;"><a href="{$list[$i][href]}"><span style="font-size:11pt;"><font face="돋움">$wr_content</font></span></a></DIV></TD>
</TR>
</TABLE></TD>
</TR>
<TR>
<TD HEIGHT="3"></TD>
</TR>
</TABLE>
HEREDOC;
}
else{//// 첫번째 글 (이미지 + 제목 + 쪽글)
$image_file = "thumb1_".$image;
$image_url = "$g4[path]/data/file/$bo_table";
$image_file = "thumb1_".$image;
$image_url = "$g4[path]/data/file/$bo_table";
$wr_content = "<a href='{$list[$i][href]}'>".Shorten_String(strip_tags($list[$i][wr_content]), 210, '...')."</a>";//본문 글 줄이는 함수
//$wr_content=get_text($wr_content);
$line_shadow = "<tr><td height=1 background='{$latest_skin_path}/img/new/line_shadow01.gif'></td></tr>";
//$wr_content=get_text($wr_content);
$line_shadow = "<tr><td height=1 background='{$latest_skin_path}/img/new/line_shadow01.gif'></td></tr>";
echo <<<HEREDOC
<TABLE WIDTH="100%" BORDER="0" ALIGN="CENTER" CELLPADDING="0" CELLSPACING="0">
<TR>
<TD VALIGN="bottom" style="padding-top:7;"><a href="{$list[$i][href]}"><b><span style="font-size:14pt;">{$list[$i][subject]}</span></b></a>
</TD>
</TR>
<TR>
<TD VALIGN="bottom" style="padding-top:7;"> <a href="{$list[$i][href]}"><b><span style="font-size:12pt;">{$list[$i][wr_1]}</span></b></a>
</TD>
</TR>
<TABLE WIDTH="100%" BORDER="0" ALIGN="CENTER" CELLPADDING="0" CELLSPACING="0">
<TR>
<TD VALIGN="bottom" style="padding-top:7;"><a href="{$list[$i][href]}"><b><span style="font-size:14pt;">{$list[$i][subject]}</span></b></a>
</TD>
</TR>
<TR>
<TD VALIGN="bottom" style="padding-top:7;"> <a href="{$list[$i][href]}"><b><span style="font-size:12pt;">{$list[$i][wr_1]}</span></b></a>
</TD>
</TR>
</table>
<TABLE WIDTH="100%" BORDER="0" ALIGN="CENTER" CELLPADDING="0" CELLSPACING="0">
<TR>
<TD ALIGN="CENTER" VALIGN="top" style="padding-top:7;">
<TABLE WIDTH="100%" BORDER="0" CELLSPACING="0" CELLPADDING="0">
<TR>
<TD HEIGHT="4" COLSPAN="3"></TD>
</TR>
<TR>
<TD WIDTH="4" VALIGN="TOP"></TD>
<TD><a href="{$list[$i][href]}"><img src="$image_url/$image_file" hspace="0" VSPACE="0" border="0"></a></TD>
<TD WIDTH="4" ALIGN="RIGHT" VALIGN="TOP" BACKGROUND="{$latest_skin_path}/img/new/p_back03.gif"><IMG SRC="{$latest_skin_path}/img/new/p_border02.gif" WIDTH="4" HEIGHT="4"></TD>
</TR>
<TR>
<TD WIDTH="4" HEIGHT="4"></TD>
<TD HEIGHT="4" ALIGN="LEFT" VALIGN="TOP" BACKGROUND="{$latest_skin_path}/img/new/p_back04.gif"><IMG SRC="{$latest_skin_path}/img/new/p_border03.gif" WIDTH="4" HEIGHT="4"></TD>
<TD WIDTH="4" HEIGHT="4" ALIGN="RIGHT" VALIGN="TOP"><IMG SRC="{$latest_skin_path}/img/new/p_border04.gif" WIDTH="4" HEIGHT="4"></TD>
</TR>
</TABLE>
</TD>
<TD WIDTH="100%" ALIGN="LEFT" VALIGN="TOP"><TABLE WIDTH='100%' BORDER='0' CELLSPACING='0' CELLPADDING='2'>
<TR>
<TD VALIGN="bottom" style="padding-top:7;"> <div align="justify" style="margin-right:1; margin-left:5;">
<p><a href="{$list[$i][href]}"><span style="font-size:11pt;"><font face="돋움">$wr_content</font></span></a></p>
</DIV>
</TD>
</TR>
</TABLE></TD>
</TR>
<TR>
<TD colspan="2" HEIGHT="3"></TD>
</TR>
</TABLE>
HEREDOC;
$j=1;
}
}
<TABLE WIDTH="100%" BORDER="0" ALIGN="CENTER" CELLPADDING="0" CELLSPACING="0">
<TR>
<TD ALIGN="CENTER" VALIGN="top" style="padding-top:7;">
<TABLE WIDTH="100%" BORDER="0" CELLSPACING="0" CELLPADDING="0">
<TR>
<TD HEIGHT="4" COLSPAN="3"></TD>
</TR>
<TR>
<TD WIDTH="4" VALIGN="TOP"></TD>
<TD><a href="{$list[$i][href]}"><img src="$image_url/$image_file" hspace="0" VSPACE="0" border="0"></a></TD>
<TD WIDTH="4" ALIGN="RIGHT" VALIGN="TOP" BACKGROUND="{$latest_skin_path}/img/new/p_back03.gif"><IMG SRC="{$latest_skin_path}/img/new/p_border02.gif" WIDTH="4" HEIGHT="4"></TD>
</TR>
<TR>
<TD WIDTH="4" HEIGHT="4"></TD>
<TD HEIGHT="4" ALIGN="LEFT" VALIGN="TOP" BACKGROUND="{$latest_skin_path}/img/new/p_back04.gif"><IMG SRC="{$latest_skin_path}/img/new/p_border03.gif" WIDTH="4" HEIGHT="4"></TD>
<TD WIDTH="4" HEIGHT="4" ALIGN="RIGHT" VALIGN="TOP"><IMG SRC="{$latest_skin_path}/img/new/p_border04.gif" WIDTH="4" HEIGHT="4"></TD>
</TR>
</TABLE>
</TD>
<TD WIDTH="100%" ALIGN="LEFT" VALIGN="TOP"><TABLE WIDTH='100%' BORDER='0' CELLSPACING='0' CELLPADDING='2'>
<TR>
<TD VALIGN="bottom" style="padding-top:7;"> <div align="justify" style="margin-right:1; margin-left:5;">
<p><a href="{$list[$i][href]}"><span style="font-size:11pt;"><font face="돋움">$wr_content</font></span></a></p>
</DIV>
</TD>
</TR>
</TABLE></TD>
</TR>
<TR>
<TD colspan="2" HEIGHT="3"></TD>
</TR>
</TABLE>
HEREDOC;
$j=1;
}
}
else {//// 두번째 글 이후 (제목만)
echo <<<HEREDOC
<TABLE WIDTH="100%" BORDER="0" CELLSPACING="1" CELLPADDING="0" style="margin-top:6;">
<TR>
<TD VALIGN="BOTTOM"><IMG SRC="{$latest_skin_path}/img/icon_li.gif" align="absmiddle"><a href="{$list[$i][href]}" style=font-family:굴림; font-size:12px;><span style="font-size:10pt;"><b>{$list[$i][subject]}</b></span></a></TD>
</TR>
</TABLE>
HEREDOC;
}
}
}
if (count($list) == 0) {
echo <<<HEREDOC
<TABLE WIDTH="100%" BORDER="0" CELLSPACING="0" CELLPADDING="0">
<TR>
<TD ALIGN="LEFT" VALIGN="TOP" height="25">
기사가 없습니다.
</TD>
</TR>
</TABLE>
HEREDOC;
}
}
}
?>
</TD>
</TR></TABLE>
echo <<<HEREDOC
<TABLE WIDTH="100%" BORDER="0" CELLSPACING="0" CELLPADDING="0">
<TR>
<TD ALIGN="LEFT" VALIGN="TOP" height="25">
기사가 없습니다.
</TD>
</TR>
</TABLE>
HEREDOC;
}
}
}
?>
</TD>
</TR></TABLE>
extend/latest_group.lib.php
----------------------------------------
<?
if (!defined('_GNUBOARD_')) exit;
/// 함수 정의 시작
----------------------------------------
<?
if (!defined('_GNUBOARD_')) exit;
/// 함수 정의 시작
// 최신글 추출 - 선택한 그룹별로 원하는 수만큼 보여줌
function latest_group($skin_dir="", $gr_id, $rows=10, $subject_len=40, $category="", $orderby="")
{
global $config;
global $g4;
function latest_group($skin_dir="", $gr_id, $rows=10, $subject_len=40, $category="", $orderby="")
{
global $config;
global $g4;
$list = array();
$limitrows = $rows;
$limitrows = $rows;
$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);
$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]";
$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];
$bo_table = $rowgroup[bo_table];
// 테이블 이름구함
$sql = " select * from {$g4[board_table]} where bo_table = '$bo_table'";
$board = sql_fetch($sql);
$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";
$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];
}
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_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);
}
}
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;
}
/// 함수 정의 끝
?>
include "$latest_skin_path/latest.skin.php";
$content = ob_get_contents();
ob_end_clean();
return $content;
}
/// 함수 정의 끝
?>
댓글 전체

유아원님께서 링크 걸어주셨던 lib 내용을 적용해봤는데 에러가 납니다.
그 게시물은 그 스킨에만 적용되는 lib 아닌가요?
select a.*, b.bo_subject, c.gr_subject, c.gr_id from g4_board_new a, g4_board b, g4_group c where a.bo_table = b.bo_table and b.gr_id = c.gr_id and b.bo_use_search = '1' and b.gr_id = 'news' and a.wr_id = a.wr_parent order by limit 46
1064 : You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'limit 46' at line 4
error file : /bbs/news_test.php
그 게시물은 그 스킨에만 적용되는 lib 아닌가요?
select a.*, b.bo_subject, c.gr_subject, c.gr_id from g4_board_new a, g4_board b, g4_group c where a.bo_table = b.bo_table and b.gr_id = c.gr_id and b.bo_use_search = '1' and b.gr_id = 'news' and a.wr_id = a.wr_parent order by limit 46
1064 : You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'limit 46' at line 4
error file : /bbs/news_test.php

이미지를 불러오기위한 부분이 있을 것 입니다~~
<?=group_new("스킨명", "그룹명", "", 5, 40);?>
이렇게 적용해보니 목록 왼쪽에 붙는 아이콘만 출력되고 제목이 출력되지 않는군요.
이렇게 적용해보니 목록 왼쪽에 붙는 아이콘만 출력되고 제목이 출력되지 않는군요.

최근 게시물인가요 최신 글인가요...
최근 게시물입니다.

썸네일 코드를 넣으면 문제가 생기네요...
이미지가 없을경우 다른이미지로 생성되네요..
썸네일을뺀파일을 다운받으시면 될 것 같네요.
썸네일을 생성하지 않을 때에는 잘 작동합니다~
http://www.sir.co.kr/bbs/tb.php/g4_qa/25594
저는 여기까지~ ^ ^
이미지가 없을경우 다른이미지로 생성되네요..
썸네일을뺀파일을 다운받으시면 될 것 같네요.
썸네일을 생성하지 않을 때에는 잘 작동합니다~
http://www.sir.co.kr/bbs/tb.php/g4_qa/25594
저는 여기까지~ ^ ^