마

ccc님껄 제나름대로 수정해본 최신글추출

userlib.inc.php의 내용입니다....######################
<? ccc님껄 제나름대로 수정해본 최신글추출

저의 경우는 /index.php
--[board]
--[list_skin]/[images]
/notice_skin.php
/main_skin.php
/photo_skin.php
--[include]  /userlib.inc.php
요렇게 구성하고, $cfg[url] 을 사용하지 않았습니다.
어짜피 설치시에 config.inc.php를 다 건드려서 수정하시는분은 드물기 때문에
$filedir="/board/data/file"; 요렇게 직접 줫습니다.
글구 테이블을 자꾸 반복하는거가 좀 그래서 중간에 newlist함수 안에서 테이블로 감싸고
스킨에서는 <tr>내용</tr>만 반복하도록 했습니다.

// 최신글 추출
function newlist($skins, $bo_table, $rows, $subjectlen='')
{
global $cfg;

$sql = " select * from $cfg[table_board] where bo_table = '$bo_table' ";
$bd = sql_fetch_array($sql);

if ($subjectlen == '') $subjectlen = $bd[bo_subject_len];


$cfg[board_table_prefix] = "사용자지정_"; // 게시판 테이블의 접두사

// $cfg[url]     = "http://www.ibokzi.com";    // 개인설정그누보드 경로에 맞게수정하세요 -- 전 사용안해요 절대경로

// $skindir      = "$cfg[url]/$cfg[list_skin]/$skins";
$skinimg      = "/list_skin/images";                        // 이미지파일을 images폴더에 넣는걸 기본으로했습니다.
$filedir      = "/board/data/file";                    //파일디렉토리

$table = "{$cfg[board_table_prefix]}{$bo_table}";
$result = sql_query_error(" select * from $table where wr_comment = 0 order by wr_id desc limit {$rows} ");
echo "<table>";
for ($i = 0; $row = mysql_fetch_array($result); $i++) {

        $wr_subject     = get_text(cut_str($row[wr_subject], $subjectlen, '…'));
        $wr_content     = get_text(cut_str($row[wr_content], 60, '…'));           // 내용 미리보기를 위해 넣었습니다. 400자까지만 짜르기했습니다.
        $wr_memo        = $row[wr_content];                                        // 내용 미리보기를 위해 넣었습니다. 400자까지만 짜르기했습니다.
        $wr_id          = $row[wr_id];                                             // 게시판번호
        $wr_name        = $row[wr_name];                                           // 게시자이름 혹 최신글에 이름출력을 위해 변수선언했습니다.
        $wr_datetime    = $row[wr_datetime];                                       // 최신글에 날짜까지 출력하고싶을때를 위해 변수선언했습니다.
        $wr_commentcnt = $row[wr_commentcnt];
         if(0<$wr_commentcnt != ""){
            $wr_commentcnt = "($wr_commentcnt)";
             }else{
            $wr_commentcnt = "";
             }
        $image = $row[wr_file1];                                                   // 이미지를 뽑을 때 사용
         if(0<$image != ""){
            $image = "<img src=$filedir/$image height=35 width=35 border=1>";
             }else{
            $image = "<img src=$filedir/noimage.gif height=35 width=35 border=1>";
             }
    /*    $icon = $row[wr_icon];                                                     // 아이콘을 뽑을때 사용
         if(0<$icon != ""){
            $icon = "<img src=$skindir/icon/icon_$icon.gif height=35 width=35 border=1>";
             }else{
            $icon = "";
             }
*/
        $mb_icon = $mb_id = "";                                                    // 멤버 아이콘을 뽑을 때 사용
         if ($row[mb_id]) {
        $sql2 = " select mb_icon from gb_member where mb_id = '$row[mb_id]' ";
        $row2 = sql_fetch_array($sql2);
         if ($row2[mb_icon])
        $mb_icon = "<img src='/board/data/member/$row2[mb_icon]' align=absmiddle'>";
         }

        $ca_name = $wr_id = "";                                                    // 분류를 뽑을 때 사용
         if ($row[wr_id]) {
        $sql1 = " select ca_name from {$table}_cat where ca_id = '$row[ca_id]'";
        $row1 = sql_fetch_array($sql1);
         if ($row1[ca_name])
        $ca_name = "[$row1[ca_name]]";
         }

$icon_file = "";
    if ($row[wr_file1] || $row[wr_file2])
        $icon_file = "<img src='$skinimg/icon_file.gif' align=absmiddle>";

    $icon_link = "";
    if ($row[wr_link1] || $row[wr_link2])
        $icon_link = "<img src='$skinimg/icon_link.gif' align=absmiddle>";

    $a_list_link = "<a href='/board/gbview.php?bo_table=$bo_table&wr_id=$row[wr_id]' class=s_a>";

    $icon_new = "";
    if ($row[wr_datetime] >= date("Y-m-d H:i:s", time() - $bd[bo_new] * 3600))
        $icon_new = "<img src='$skinimg/icon_new.gif' align=absmiddle'>";

    $icon_hot = "";
    if ($row[wr_hit] >= $bd[bo_hot])
        $icon_hot = "<img src='$skinimg/icon_hot.gif' align=absmiddle'>";

    $icon_battle = "";
    if ($row[wr_commentcnt] >= $bd[bo_battle])
        $icon_battle = "<img src='$skinimg/icon_battle.gif' align=absmiddle'>";
    $icon_secret = "";
    if ($row[wr_secret])
        $icon_secret = "<img src='$skinimg/icon_secret.gif' align=absmiddle'>";

// include "./$cfg[list_skin]/$skins/newlist_main.skin.php";
include "/home/hosting_users/user_id/html/list_skin/$skin_skin.php";
//  $skin은 공지사항 notice, 일반형 nomal, 사진형 photo_skin.php
echo "</table>";
}
mysql_free_result($result);

}

?>
|

댓글 2개

감사합니다.
// include "./$cfg[list_skin]/$skins/newlist_main.skin.php";
include "/home/hosting_users/user_id/html/list_skin/$skin_skin.php";
// $skin은 공지사항 notice, 일반형 nomal, 사진형 photo_skin.php
이부분의 사용법이 명확히 안나와 있군요.... 공지 사항 일때 메모형태로 1개와 나머지 제목갯수로 뽑을 수 있나요.?
댓글을 작성하시려면 로그인이 필요합니다.
+
제목 글쓴이 날짜 조회
03-04-30 조회 3,460
깜깜보
03-04-29 조회 2,429
03-04-29 조회 2,388
03-04-26 조회 2,443
03-04-25 조회 2,805
03-04-25 조회 2,509
03-04-21 조회 4,477
03-04-19 조회 4,480
03-04-17 조회 3,933
03-04-15 조회 2,667
03-04-11 조회 2,718
03-04-11 조회 3,084
03-04-11 조회 2,374
03-04-10 조회 3,678
03-04-09 조회 3,631
03-04-08 조회 2,950
03-04-07 조회 3,854
03-04-04 조회 3,362
03-04-02 조회 2,540
03-04-02 조회 2,698