불당님 이것좀 봐주세요 > 그누4 질문답변

그누4 질문답변

그누보드4 관련 질문은 QA 로 이전됩니다. QA 그누보드4 바로가기
기존 게시물은 열람만 가능합니다.

불당님 이것좀 봐주세요 정보

불당님 이것좀 봐주세요

본문

불쑥 지명해서 질문 드려 지송합니다.
불당님 스킨중 에서 잘 안되는것이 있어서요 ^^;
 
 
 
지식랭킹 스킨인데요 올리신  되로 적용을 하였는데 도무지 작동을 안하네요
 
 
헤드에  아래 소스를 넣었구요
<?=popular_jisik("basic_jisik", 5, 30, "jisik"); // 지식랭킹 ?>
 
jisik 이란 테이블명의 게시판 생성하였습니다.
 
skin/popular/basic_jisik  폴더에 첨부파일 업로드 했습니다.
 
popular.lib.php 파일에 소스 추가 했습니다.
 
------------------------------------------------------------------------------------------------
<?
if (!defined('_GNUBOARD_')) exit;
// 인기검색어 출력
// $skin_dir : 스킨 디렉토리
// $pop_cnt : 검색어 몇개
// $date_cnt : 몇일 동안
function popular($skin_dir='basic', $pop_cnt=4, $date_cnt=3)
{
    global $config, $g4;
    if (!$skin_dir) $skin_dir = 'basic';
    $date_gap = date("Y-m-d", $g4[server_time] - ($date_cnt * 86400));
    $sql = " select pp_word, count(*) as cnt from $g4[popular_table]
              where pp_date between '$date_gap' and '$g4[time_ymd]'
              group by pp_word
              order by cnt desc, pp_word
              limit 0, $pop_cnt ";
    $result = sql_query($sql);
    for ($i=0; $row=sql_fetch_array($result); $i++)
    {
        $list[$i] = $row;
        // 스크립트등의 실행금지
        $list[$i][pp_word] = get_text($list[$i][pp_word]);
    }
    ob_start();
    $popular_skin_path = "$g4[path]/skin/popular/$skin_dir";
    include_once ("$popular_skin_path/popular.skin.php");
    $content = ob_get_contents();
    ob_end_clean();
    return $content;
}
 
//  추가한 소스
function popular_jisik($skin_dir='basic_jisik', $pop_cnt=7, $date_cnt=30, $bo_id)
{
    global $config, $g4;
    if (!$skin_dir) $skin_dir = 'basic_jisik';
    $date_gap = date("Y-m-d", $g4[server_time] - ($date_cnt * 86400));
    $sql = " select a.*, b.mb_nick, count(*) as cnt, sum(a.wr_1) as point_sum
              from $g4[write_prefix]$bo_id a left join g4_member b on a.wr_3 = b.mb_id
              where a.wr_is_comment = 0 and trim(a.wr_3) <> '' and wr_datetime between '$date_gap' and '$g4[time_ymd]'
              group by a.wr_3
              order by cnt desc, point_sum desc 
            limit 0, $pop_cnt ";
    $result = sql_query($sql);
    for ($i=0; $row=sql_fetch_array($result); $i++)
    {
        $list[$i] = $row;
        // 스크립트등의 실행금지
        $list[$i][pp_word] = get_text($list[$i][pp_word]);
    }
    ob_start();
    $popular_skin_path = "$g4[path]/skin/popular/$skin_dir";
    include_once ("$popular_skin_path/popular.skin.php");
    $content = ob_get_contents();
    ob_end_clean();
    return $content;
}
 
?>
  • 복사

댓글 전체

아래처럼 주석처리 되어있지 않습니다.
인기검색어는 잘나옵니다.

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

include_once("$g4[path]/head.sub.php");
include_once("$g4[path]/lib/outlogin.lib.php");
include_once("$g4[path]/lib/poll.lib.php");
include_once("$g4[path]/lib/visit.lib.php");
include_once("$g4[path]/lib/connect.lib.php");
include_once("$g4[path]/lib/popular.lib.php");
혹...config.php에서

$g4['table_prefix']        = "g4_"; // 테이블명 접두사 를 수정하시지 않으셨나요...?

소스에는 크게 문제가 없어 보입니다만 혹 위 줄처럼 수정하였을 수도 있으므로
위 질문 본문의 붉은 글씨기준으로 8번째줄 중간 우측의 g4_member  를
$g4[member_table] 로 바꾸어 보세요..

해당 팁기준으로 이 댓글 내용과 같은 경우가 발생할 수 있으므로 팁에서 수정이나 해당 댓글이 필요할 듯 합니다.

아니면 한페이지에 인기검색어와 지식랭킹을 함께 사용하고자 한다면 아니될수도 있습니다.
한페이지에 인기검색어와 지식랭킹을 함께 사용하고자 한다면 질문본문 하단에서 6째줄

include_once ("$popular_skin_path/popular.skin.php");



include ("$popular_skin_path/popular.skin.php");

로 바꾸세요.....
음~~! 저의 경우 popular function을 복사하여 popular1으로 하고 한페이지 내에
<?=popular();?>
<?=popular1();?>
했을 경우 하나밖에 출력이 안되어서 위와 같이

include_once ("$popular_skin_path/popular.skin.php");



include ("$popular_skin_path/popular.skin.php");
로 바꾸었을 경우 정상적으로 출력이 됩니다...

정 안되실경우 위에 다운받으신 화일중 스킨화일의 출력부에 echo "테스트문"; 하시고
불러보세요..
테스트문이 출력된다면 function보다는 해당 쿼리문이나 자료가 없을 경우 일수도 있습니다.
스킨내용입니다.

지식랭킹 이라는 글자는 출력됩니다.  이제 그만 포기할까봐요 ㅡ,ㅜ


<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
?>
지식랭킹 <br>
<?
for ($i=0; $i<count($list); $i++) {
    $j = $i + 1;
    echo "{$j}. {$list[$i][mb_nick]} ({$list[$i][cnt]}/{$list[$i][point_sum]})<br>";
}
?>
프로그램 자체가 원본의 sql문장을 기준으로 수정한 것인데... 안된다뇨?
그리고 질문 하실 때 안된다 보다는 어떤 오류가 나오는지 정확하게 언급을
해주셔야 합니다. 막연히 안된다면... ㅠ..ㅠ

제가 만들어준 http://plam.co.kr/bbs/board.php?bo_table=user_qa 에서는 원본 그대로 잘 쓰고 있거든요.
popular.lib.php의

$sql = " select a.*, b.mb_nick, count(*) as cnt, sum(a.wr_1) as point_sum
              from $g4[write_prefix]$bo_id a left join g4_member b on a.wr_3 = b.mb_id
              where a.wr_is_comment = 0 and trim(a.wr_3) <> '' and wr_datetime between '$date_gap' and '$g4[time_ymd]'
              group by a.wr_3
              order by cnt desc, point_sum desc 
            limit 0, $pop_cnt ";



$sql = " select a.*, b.mb_nick, count(*) as cnt, sum(a.wr_1) as point_sum
              from $g4[write_prefix]$bo_id a left join $g4[member_table] b on a.wr_3 = b.mb_id
              where a.wr_is_comment = 0 and trim(a.wr_3) <> '' and left(wr_datetime,10) between '$date_gap' and '$g4[time_ymd]'
              group by a.wr_3
              order by cnt desc, point_sum desc 
            limit 0, $pop_cnt ";

로 바꾸어 보세요...
TOGETHER 님 정말 감사합니다 .
드디어 성공 했습니다. ^^;
어제부터 답변해주시고 다시한번 감사합니다.

원본 소스 올려주신 불당님도 감사 합니다. ^^
© SIRSOFT
현재 페이지 제일 처음으로