테스트 사이트 - 개발 중인 베타 버전입니다

최신글에서 게시판 두개 나오게 하는 것 질문 채택완료

왕초보오 7년 전 조회 1,973

 

하나만 나오는거는 위와 같이 해서 나오는데요 

두개가 나오게 하려면 어떻게 해야해요?

왕초보라 힘드네요.

댓글을 작성하려면 로그인이 필요합니다.

답변 4개

채택된 답변
+20 포인트
7년 전

참고해보세요.

https://sir.kr/g5_tip/4103

로그인 후 평가할 수 있습니다

댓글을 작성하려면 로그인이 필요합니다.

theme/basic/index 파일을 아래와같이 하였고요.

if (G5_IS_MOBILE) {     include_once(G5_THEME_MOBILE_PATH.'/index.php');     return; }

include_once(G5_THEME_PATH.'/head.php'); ?>

최신글

'mobile' "; if(!$is_admin)     $sql .= " and a.bo_use_cert = '' "; $sql .= " order by b.gr_order, a.bo_order "; $result = sql_query($sql); for ($i=0; $row=sql_fetch_array($result); $i++) {     if ($i%2==1) $lt_style = "margin-left:20px";     else $lt_style = ""; ?>    
       

   

-------------------------------------------------------------------

lib/latest.lib 파일안에 길다란 글을 덧붙여서 아래와같이 하였는데 안됩니다.

아래는 덧붙인 latest.lib 입니다.

오늘 마지막 글입니다.

안되면 내일을 기다려야 함.ㅠㅠ

// 최신글 추출 // $cache_time 캐시 갱신시간 function latest($skin_dir='', $bo_table, $rows=10, $subject_len=40, $cache_time=1, $options='') {     global $g5;

    if (!$skin_dir) $skin_dir = 'basic';

    if(preg_match('#^theme/(.+)$#', $skin_dir, $match)) {         if (G5_IS_MOBILE) {             $latest_skin_path = G5_THEME_MOBILE_PATH.'/'.G5_SKIN_DIR.'/latest/'.$match[1];             if(!is_dir($latest_skin_path))                 $latest_skin_path = G5_THEME_PATH.'/'.G5_SKIN_DIR.'/latest/'.$match[1];             $latest_skin_url = str_replace(G5_PATH, G5_URL, $latest_skin_path);         } else {             $latest_skin_path = G5_THEME_PATH.'/'.G5_SKIN_DIR.'/latest/'.$match[1];             $latest_skin_url = str_replace(G5_PATH, G5_URL, $latest_skin_path);         }         $skin_dir = $match[1];     } else {         if(G5_IS_MOBILE) {             $latest_skin_path = G5_MOBILE_PATH.'/'.G5_SKIN_DIR.'/latest/'.$skin_dir;             $latest_skin_url  = G5_MOBILE_URL.'/'.G5_SKIN_DIR.'/latest/'.$skin_dir;         } else {             $latest_skin_path = G5_SKIN_PATH.'/latest/'.$skin_dir;             $latest_skin_url  = G5_SKIN_URL.'/latest/'.$skin_dir;         }     }

    $cache_fwrite = false;     if(G5_USE_CACHE) {         $cache_file = G5_DATA_PATH."/cache/latest-{$bo_table}-{$skin_dir}-{$rows}-{$subject_len}.php";

        if(!file_exists($cache_file)) {             $cache_fwrite = true;         } else {             if($cache_time > 0) {                 $filetime = filemtime($cache_file);                 if($filetime && $filetime < (G5_SERVER_TIME - 3600 * $cache_time)) {                     @unlink($cache_file);                     $cache_fwrite = true;                 }             }

            if(!$cache_fwrite)                 include($cache_file);         }     }

    if(!G5_USE_CACHE || $cache_fwrite) {         $list = array();

        $sql = " select * from {$g5['board_table']} where bo_table = '{$bo_table}' ";         $board = sql_fetch($sql);         $bo_subject = get_text($board['bo_subject']);

        $tmp_write_table = $g5['write_prefix'] . $bo_table; // 게시판 테이블 전체이름         $sql = " select * from {$tmp_write_table} where wr_is_comment = 0 order by wr_num limit 0, {$rows} ";         $result = sql_query($sql);         for ($i=0; $row = sql_fetch_array($result); $i++) {             $list[$i] = get_list($row, $board, $latest_skin_url, $subject_len);         }

        if($cache_fwrite) {             $handle = fopen($cache_file, 'w');             $cache_content = "";             fwrite($handle, $cache_content);             fclose($handle);         }     }

    ob_start();     include $latest_skin_path.'/latest.skin.php';     $content = ob_get_contents();     ob_end_clean();

    return $content; } ?>

    global $g5;

    if (!$skin_dir) $skin_dir = 'basic';

    if(preg_match('#^theme/(.+)$#', $skin_dir, $match)) {         if (G5_IS_MOBILE) {             $latest_skin_path = G5_THEME_MOBILE_PATH.'/'.G5_SKIN_DIR.'/latest/'.$match[1];             if(!is_dir($latest_skin_path))                 $latest_skin_path = G5_THEME_PATH.'/'.G5_SKIN_DIR.'/latest/'.$match[1];             $latest_skin_url = str_replace(G5_PATH, G5_URL, $latest_skin_path);         } else {             $latest_skin_path = G5_THEME_PATH.'/'.G5_SKIN_DIR.'/latest/'.$match[1];             $latest_skin_url = str_replace(G5_PATH, G5_URL, $latest_skin_path);         }         $skin_dir = $match[1];     } else {         if(G5_IS_MOBILE) {             $latest_skin_path = G5_MOBILE_PATH.'/'.G5_SKIN_DIR.'/latest/'.$skin_dir;             $latest_skin_url  = G5_MOBILE_URL.'/'.G5_SKIN_DIR.'/latest/'.$skin_dir;         } else {             $latest_skin_path = G5_SKIN_PATH.'/latest/'.$skin_dir;             $latest_skin_url  = G5_SKIN_URL.'/latest/'.$skin_dir;         }     }

        $list = array();         $sql_common = " from {$g5['board_new_table']} a  where find_in_set(a.bo_table, '{$bo_tables}')";         $sql_common .= " and a.wr_id = a.wr_parent ";         $sql_order = " order by a.bn_id desc ";         $sql = " select a.* {$sql_common} {$sql_order} limit 0, {$rows}";

        $result = sql_query($sql);                  for ($i=0; $row=sql_fetch_array($result); $i++) {

            $sql = " select * from {$g5['board_table']} where bo_table = '{$row['bo_table']}' ";

          

            $board = sql_fetch($sql);

            $tmp_write_table = $g5['write_prefix'] . $row['bo_table'];             $row2 = sql_fetch(" select * from {$tmp_write_table} where wr_id = '{$row['wr_id']}' ");

            $list[$i] = $row2;             $list[$i] = get_list($row2, $board, $latest_skin_url, $subject_len);             $list[$i]['bo_subject'] = $row['bo_subject'];             $list[$i]['bo_table'] = $row['bo_table'];         }

    ob_start();     include $latest_skin_path.'/latest.skin.php';     $content = ob_get_contents();     ob_end_clean();

    return $content; } ?>  

자세히 가르처주시면 백골난망이겠습니다.

컴 교육이라고는 하나도 받지 못한 쉰세대라 힘이듭니다.

감사합니다.

로그인 후 평가할 수 있습니다

댓글을 작성하려면 로그인이 필요합니다.

latest.lib.php 파일맨 아래에 위의 길다란 소스를 전부 넣고 그 아래에  echo latest_all("basic", "gaia01,gaia02", 3, 15);  위와같은 형식으로 넣었는데 왜 안되죠?  그니까 위에 본문 길다란거를 latest.lib.php 파일 맨 하단에 추가하고나서  또 그 아래에 echo latest_all("basic", "gaia01,gaia02", 3, 15); 을 넣었습니다.  하나의 게시판 gaia01 만 출력됩니다.ㅠㅠ

 

다시 말씀 드리면

기존 latest.lib.php 파일 아래에

위의 길다란 소스

+     echo latest_all("basic", "gaia01,gaia02", 3, 15);

하나의 게시판만 출력됨

 

1.덧붙인 소스에 추가할 것이 있는지 여부

2. 덧붙인 소스를 위의 길다란 장문 중간 어디에 넣어야 하는건지 여부

3.latest.lib.php 이곳에 추가로 덧붙이는거 맞는지 여부

위 3가지가 질문의 요지이구요.

만약 아니라면 어디에 위의 소스를 어느부분에 넣어야 하는지 부탁드립니다.

로그인 후 평가할 수 있습니다

답변에 대한 댓글 1개

s
sinbi
7년 전
echo latest_all("basic", "gaia01,gaia02", 3, 15); 소스는 함수 아래 넣는 게 아니라,

출력하실 곳에 넣습니다. (예를 들어, 메인 경우, index.php 파일)

그리고,

php 소스니까, 앞에 아래처럼 넣어주셔야 해요.
<?php echo latest_all("basic", "gaia01,gaia02", 3, 15); ?>

댓글을 작성하려면 로그인이 필요합니다.

위와같이 하면 안되네요.

이거 theme/basic 경로의 index 파일 수정하는거는 맞죠?

 

 

로그인 후 평가할 수 있습니다

답변에 대한 댓글 1개

작은별
7년 전
최신글 기본 함수가 아니라 새로 함수를 추가해서 하는 겁니다.
본문 내용을 처음부터 살펴보세요. 팁에 있는 내용 그대로 적용해야 합니다.
latest_all 함수를 추가하고 해당 함수로 출력하는 겁니다.
latest_all("스킨명", "게시판명1,게시판명2,게시판명3,게시판명4", 출력갯수, 글자수);

댓글을 작성하려면 로그인이 필요합니다.

답변을 작성하려면 로그인이 필요합니다.

로그인