스크랩에서 첫번째 이미지를 뽑자. > 그누4 팁자료실

그누4 팁자료실

그누보드4와 관련된 팁을 여러분들과 함께 공유하세요.
나누면 즐거움이 커집니다.

스크랩에서 첫번째 이미지를 뽑자. 정보

스크랩에서 첫번째 이미지를 뽑자.

본문

bbs/scrap.php 입니다.

<?
include_once("./_common.php");

if (!$member[mb_id])
    alert_close("회원만 조회하실 수 있습니다.");

$g4[title] = $member[mb_nick] . "님의 스크랩";
include_once("$g4[path]/head.sub_t.php");

$list = array();

$sql_common = " from $g4[scrap_table] where mb_id = '$member[mb_id]' ";
$sql_order = " order by ms_id desc ";

$sql = " select count(*) as cnt $sql_common ";
$row = sql_fetch($sql);
$total_count = $row[cnt];

$rows = $config[cf_page_rows];
$total_page  = ceil($total_count / $rows);  // 전체 페이지 계산
if (!$page) $page = 1; // 페이지가 없으면 첫 페이지 (1 페이지)
$from_record = ($page - 1) * $rows; // 시작 열을 구함

$list = array();

$sql = " select *
          $sql_common
          $sql_order
          limit $from_record, $rows ";
$result = sql_query($sql);
for ($i=0; $row=sql_fetch_array($result); $i++)
{
    $list[$i] = $row;

    // 순차적인 번호 (순번)
    $num = $total_count - ($page - 1) * $rows - $i;

    // 게시판 제목
    $sql2 = " select bo_subject from $g4[board_table] where bo_table = '$row[bo_table]' ";
    $row2 = sql_fetch($sql2);
    if (!$row2[bo_subject]) $row2[bo_subject] = "[게시판 없음]";

    // 게시물 제목
    $tmp_write_table = $g4[write_prefix] . $row[bo_table];
    $sql3 = " select wr_subject from $tmp_write_table where wr_id = '$row[wr_id]' ";
    $row3 = sql_fetch($sql3, FALSE);
    $subject = get_text(cut_str($row3[wr_subject], 100));
    if (!$row3[wr_subject])
        $row3[wr_subject] = "[글 없음]";

    //첫번째 이미지를 뽑자(천상재회 2006/11/29)
$sql4 = " select * from $g4[board_file_table] where bo_table = '$row[bo_table]' and wr_id = '$row[wr_id]' and bf_no = '0' ";
    $result4 = sql_query($sql4);
    $row4 = sql_fetch_array($result4);
$list[$i][bf_file] = $row4['bf_file'];
    $list[$i][bf_source] = $row4['bf_source'];
$list[$i][bo_table] = $row4['bo_table'];
    //이미지 관련 끝

    $list[$i][num] = $num;
    $list[$i][opener_href] = "./board.php?bo_table=$row[bo_table]";
    $list[$i][opener_href_wr_id] = "./board.php?bo_table=$row[bo_table]&wr_id=$row[wr_id]";
    $list[$i][bo_subject] = $row2[bo_subject];
    $list[$i][subject] = $subject;
    $list[$i][del_href] = "./scrap_delete.php?ms_id=$row[ms_id]&page=$page";
}

$member_skin_path = "$g4[path]/skin/member/$config[cf_member_skin]";
include_once("$member_skin_path/scrap.skin.php");

include_once("$g4[path]/tail.sub.php");
?>

skin/member/basic/scrap.skin.php 입니다.
해당 스킨 이미지 경로에 noimage.gif 하나 맹글어 넣으세요...

<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
?>

<table width="600" height="50" border="0" cellpadding="0" cellspacing="0">
<tr>
    <td align="center" valign="middle" bgcolor="#EBEBEB">
        <table width="590" height="40" border="0" cellspacing="0" cellpadding="0">
        <tr>
            <td width="25" align="center" bgcolor="#FFFFFF" ><img src="<?=$member_skin_path?>/img/icon_01.gif" width="5" height="5"></td>
            <td width="75" align="left" bgcolor="#FFFFFF" ><font color="#666666"><b>스크랩</b></font></td>
            <td width="490" bgcolor="#FFFFFF" ></td>
        </tr>
        </table></td>
</tr>
</table>

<table width="600" border="0" cellspacing="0" cellpadding="0">
<tr>
    <td height="200" align="center" valign="top">
        <table width="540" border="0" cellspacing="0" cellpadding="0">
        <tr>
            <td height="20"></td>
        </tr>
        <tr>
            <td height="2" bgcolor="#808080"></td>
        </tr>
        <tr>
            <td width="540" bgcolor="#FFFFFF">
                <table width=100% cellpadding=1 cellspacing=1 border=0>
                <tr bgcolor=#E1E1E1 align=center>
                    <td width="10%" height="24"><b>번호</b></td>
                    <td width="12%"><b>게시판</b></td>
                    <td width="38%"><b>제목</b></td>
                    <td width="25%"><b>보관일시</b></td>
                    <td width="10%"><b>삭제</b></td>
                </tr>

                <? for ($i=0; $i<count($list); $i++) {
$sf = $list[$i][bf_file];
$img_1 = "$g4[path]/data/file/" .$list[$i][bo_table] ."/" .$list[$i][bf_file];
if ((file_exists($img_1)) && (preg_match("/\.($config[cf_image_extension])$/i", $sf))) {

                    } else {
                    $img_1 = "$member_skin_path/img/noimage.gif";
                    }

?>
                    <tr height=25 bgcolor="#F6F6F6" align="center">
                        <td height="24"><?=$list[$i][num]?></td>
                        <td><img src='<?=$img_1?>' style='border:1px solid #E8ECEF;padding:2px;' width='120' height='80' alt=''><br><a href="javascript:;" onclick="opener.document.location.href='<?=$list[$i][opener_href]?>';"><?=$list[$i][bo_subject]?></a></td>
                        <td align="left" style='word-break:break-all;'>&nbsp;<a href="javascript:;" onclick="opener.document.location.href='<?=$list[$i][opener_href_wr_id]?>';"><?=$list[$i][subject]?></a></td>
                        <td><?=$list[$i][ms_datetime]?></td>
                        <td><a href="javascript:del('<?=$list[$i][del_href]?>');"><img src="<?=$member_skin_path?>/img/btn_comment_delete.gif" width="45" height="14" border="0"></a></td>
                    </tr>
                <? } ?>

                <? if ($i == 0) echo "<tr><td colspan=5 align=center height=100>자료가 없습니다.</td></tr>"; ?>
                </table></td>
        </tr>
        </table></td>
</tr>
<tr>
    <td height="30" align="center"><?=get_paging($config[cf_write_pages], $page, $total_page, "?$qstr&page=");?></td>
</tr>
<tr>
    <td height="2" align="center" valign="top" bgcolor="#D5D5D5"></td>
</tr>
<tr>
    <td height="2" align="center" valign="top" bgcolor="#E6E6E6"></td>
</tr>
<tr>
    <td height="40" align="center" valign="bottom"><a href="javascript:window.close();"><img src="<?=$member_skin_path?>/img/btn_close.gif" width="48" height="20" border="0"></a></td>
</tr>
</table>
<br>

스킨코딩은 원하시는 대로 코딩 하십시오..
추천
1

댓글 7개

미치겠네요^^

실력은 안되고 이걸 만들어야 하는데 생각만하고 있었는데

웬일입니까?

천상재회님 너무 너무 감사합니다^^
전체 3,313 |RSS
그누4 팁자료실 내용 검색

회원로그인

(주)에스아이알소프트 / 대표:홍석명 / (06211) 서울특별시 강남구 역삼동 707-34 한신인터밸리24 서관 1404호 / E-Mail: admin@sir.kr
사업자등록번호: 217-81-36347 / 통신판매업신고번호:2014-서울강남-02098호 / 개인정보보호책임자:김민섭(minsup@sir.kr)
© SIRSOFT