인덱스에 첨가하여 2개의 게시판에서 리스트를 불러드리려고 합니다

인덱스에 첨가하여 2개의 게시판에서 리스트를 불러드리려고 합니다

QA

인덱스에 첨가하여 2개의 게시판에서 리스트를 불러드리려고 합니다

본문

아래의 소스를 인덱스에 첨가하여 2개의 게시판에서 리스트를 불러드리려고 합니다.
위에 것은 불러들려지는데 아래 것은 에러입니다. 
skin.lib.php에서 안된다고 하는 데 어떻게 해야하나요.
감사합니다.

----------소스----------
<? 
$bo_table='B1_List';//게시판명 
$write_table=$g4[write_prefix].$bo_table; 
$board=sql_fetch("select * from $g4[board_table] where bo_table='$bo_table'"); 
$board_skin_path = "{$g4['path']}/skin/board/{$board['bo_skin']}"; 
include_once("$board_skin_path/list.main.skin.php");
?> 

<? 
$bo_table='B2_List';//게시판명 
$write_table=$g4[write_prefix].$bo_table; 
$board=sql_fetch("select * from $g4[board_table] where bo_table='$bo_table'"); 
$board_skin_path = "{$g4['path']}/skin/board/{$board['bo_skin']}"; 
include_once("$board_skin_path/list.skin.php");
?> 


이 질문에 댓글 쓰기 :

답변 2

글루님, 답변 감사합니다
에러메시지는 한번 불러왔기 때문에 다음 것을 불러 올 수 없다고 하는 메시지가 나오네요.
메시지는 120번째 부분에 문제가 있다고 나오는데요.
2개를 불러오려면 어떻게 해야하나요.
아래는 skin.lib.php 입니다.
감사합니다.
----skin.lib.php 소스---
<?

// 추가 및 변경 함수 시작
$arr_search = array();
for($j = 1; $j < 101; $j++){
if($_GET["wr_".$j] && strlen($_GET["wr_".$j]) > 0){
$qstr .= "&wr_".$j."=".urlencode($_GET["wr_".$j]);
}
}

// 검색 구문을 얻는다.
//function get_sql_search($search_ca_name, $search_field, $search_text, $search_operator=false)
function get_sql_search2($search_ca_name, $search_field, $search_text, $search_operator='and',$search_arr='')
{
    global $g4;

    $str = "";
    if ($search_ca_name)
        $str = " ca_name = '$search_ca_name' ";

    $search_text = trim($search_text);

    if (!$search_text && !$search_arr)
        return $str;
if(count($search_arr[name]) > 0){
$se_flag = 0;
for($j = 0; $j < count($search_arr[name]); $j++){
if(is_array($search_arr[val][$j])){
$str2 = "";

for($x = 0; $x < count($search_arr[val][$j]);$x++){
$str2 = append_sql($str2, " or ", " {$search_arr[name][$j]} like '%{$search_arr[val][$j][$x]}%' ");
}
$str2 = " (".$str2.") ";
$str = append_sql($str, " and", $str2);


}else if(strlen($search_arr[val][$j]) > 0 && $search_arr[val][$j] ){
$str = append_sql($str, " and ", " {$search_arr[name][$j]}  like '%{$search_arr[val][$j]}%' ");
}
}
}
    // 쿼리의 속도를 높이기 위하여 ( ) 는 최소화 한다.
    $op1 = "";

    // 검색어를 구분자로 나눈다. 여기서는 공백
    $s = array();

    $s = explode(" ", $search_text);
if(count($s) > 0 && strlen($s[0]) > 0 ){

if ($str)
        $str .= " and ";
    // 검색필드를 구분자로 나눈다. 여기서는 +
    //$field = array();
    //$field = explode("||", trim($search_field));
    $tmp = array();
    $tmp = explode(",", trim($search_field));
    $field = explode("||", $tmp[0]);
    $not_comment = $tmp[1];

    $str .= "(";
    for ($i=0; $i<count($s); $i++) {
        // 검색어
        $search_str = trim($s[$i]);
        if ($search_str == "") continue;

        // 인기검색어
/*
        $sql = " insert into $g4[popular_table] set pp_word = '$search_str', pp_date = '$g4[time_ymd]', pp_ip = '$_SERVER[REMOTE_ADDR]' ";
        sql_query($sql, FALSE);
*/
if(count($field) > 0){
        $str .= $op1;
        $str .= "(";

        $op2 = "";
        for ($k=0; $k<count($field); $k++) { // 필드의 수만큼 다중 필드 검색 가능 (필드1+필드2...)
            $str .= $op2;
            switch ($field[$k]) {
                case "mb_id" :
                case "wr_name" :
                    $str .= " $field[$k] = '$s[$i]' ";
                    break;
                case "wr_hit" :
                case "wr_good" :
                case "wr_nogood" :
                    $str .= " $field[$k] >= '$s[$i]' ";
                    break;
                // 번호는 해당 검색어에 -1 을 곱함
                case "wr_num" :
                    $str .= "$field[$k] = ".((-1)*$s[$i]);
                    break;
                // LIKE 보다 INSTR 속도가 빠름
                default :
                    if (preg_match("/[a-zA-Z]/", $search_str))
                        $str .= "INSTR(LOWER($field[$k]), LOWER('$search_str'))";
                    else
                        $str .= "INSTR($field[$k], '$search_str')";
                    break;
            }
            $op2 = " or ";
        }
        $str .= ")";
}
        //$op1 = ($search_operator) ? ' and ' : ' or ';
        $op1 = " $search_operator ";
    }

    $str .= " ) ";
}
    if ($not_comment){
        $str .= " and wr_is_comment = '0' ";
}
    return $str;
}

function append_sql($sql, $appender, $text) {
if(strlen($sql) > 0) {
$sql = $sql.$appender.$text;
} else {
$sql = $text;
}
return $sql;
}
// 추가 및 변경 함수 끝

$arr_search = array();
for($j = 1; $j < 101; $j++){
if(($_GET["wr_".$j] && strlen($_GET["wr_".$j]) > 0 ) || is_array($_GET["wr_".$j])) {
$arr_search[name][] = "wr_".$j;
$arr_search[val][] = $_GET["wr_".$j];
}
}

// view.php 일경우 불러오는 소스 시작
if ($wr_id){

$sql_search = "";
// 검색이면
if ($sca || $stx || count($arr_search) > 0) {
// where 문을 얻음
$se_arr = array();
$se_arr = $arr_search;

$sql_search = get_sql_search2($sca, $sfl, $stx, $sop, $se_arr);
$search_href = "./board.php?bo_table=$bo_table&page=$page" . $qstr;
$list_href = "./board.php?bo_table=$bo_table";
} else {
$search_href = "";
$list_href = "./board.php?bo_table=$bo_table&page=$page";
}

if (!$board[bo_use_list_view]) {
if ($sql_search)
$sql_search = " and " . $sql_search;

// 윗글을 얻음
$sql = " select wr_id, wr_subject from $write_table where wr_is_comment = 0 and wr_num = '$write[wr_num]' and wr_reply < '$write[wr_reply]' $sql_search order by wr_num desc, wr_reply desc limit 1 ";
$prev = sql_fetch($sql);
// 위의 쿼리문으로 값을 얻지 못했다면
if (!$prev[wr_id])     {
$sql = " select wr_id, wr_subject from $write_table where wr_is_comment = 0 and wr_num < '$write[wr_num]' $sql_search order by wr_num desc, wr_reply desc limit 1 ";
$prev = sql_fetch($sql);
}

// 아래글을 얻음
$sql = " select wr_id, wr_subject from $write_table where wr_is_comment = 0 and wr_num = '$write[wr_num]' and wr_reply > '$write[wr_reply]' $sql_search order by wr_num, wr_reply limit 1 ";
$next = sql_fetch($sql);
// 위의 쿼리문으로 값을 얻지 못했다면
if (!$next[wr_id]) {
$sql = " select wr_id, wr_subject from $write_table where wr_is_comment = 0 and wr_num > '$write[wr_num]' $sql_search order by wr_num, wr_reply limit 1 ";
$next = sql_fetch($sql);
}
}

// 이전글 링크
$prev_href = "";
if ($prev[wr_id]) {
$prev_wr_subject = get_text(cut_str($prev[wr_subject], 255));
$prev_href = "./board.php?bo_table=$bo_table&wr_id=$prev[wr_id]&page=$page" . $qstr;
}

// 다음글 링크
$next_href = "";
if ($next[wr_id]) {
$next_wr_subject = get_text(cut_str($next[wr_subject], 255));
$next_href = "./board.php?bo_table=$bo_table&wr_id=$next[wr_id]&page=$page" . $qstr;
}


}
// view.php 일경우 불러오는 소스 끝

// list.php 일경우 불러오는 소스 시작
if ($member[mb_level] >= $board[bo_list_level] && $board[bo_use_list_view] || empty($wr_id)){

$sop = strtolower($sop);
if ($sop != "and" && $sop != "or")
$sop = "and";

// 분류 선택 또는 검색어가 있다면
$stx = trim($stx);
if ($sca || $stx || count($arr_search) > 0)
{

$se_arr = array();
$se_arr = $arr_search;

$sql_search = get_sql_search2($sca, $sfl, $stx, $sop, $se_arr);

// 가장 작은 번호를 얻어서 변수에 저장 (하단의 페이징에서 사용)
$sql = " select MIN(wr_num) as min_wr_num from $write_table ";
$row = sql_fetch($sql);
$min_spt = $row[min_wr_num];

if (!$spt) $spt = $min_spt;

$sql_search .= " and (wr_num between '".$spt."' and '".($spt + $config[cf_search_part])."') ";

// 원글만 얻는다. (코멘트의 내용도 검색하기 위함)
$sql = " select distinct wr_parent from $write_table where $sql_search ";
$result = sql_query($sql);
$total_count = mysql_num_rows($result);
}
else
{
$sql_search = "";

$total_count = $board[bo_count_write];
}

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

// 관리자라면 CheckBox 보임
$is_checkbox = false;
if ($member[mb_id] && ($is_admin == "super" || $group[gr_admin] == $member[mb_id] || $board[bo_admin] == $member[mb_id]))
$is_checkbox = true;

// 정렬에 사용하는 QUERY_STRING
$qstr2 = "bo_table=$bo_table&sop=$sop";

if ($board[bo_gallery_cols])
$td_width = (int)(100 / $board[bo_gallery_cols]);

// 정렬
// 인덱스 필드가 아니면 정렬에 사용하지 않음
//if (!$sst || ($sst && !(strstr($sst, 'wr_id') || strstr($sst, "wr_datetime")))) {
if (!$sst)
{
if ($board[bo_sort_field])
$sst = $board[bo_sort_field];
else
$sst  = "wr_num, wr_reply";
$sod = "";
}
else {
// 게시물 리스트의 정렬 대상 필드가 아니라면 공백으로 (nasca 님 09.06.16)
// 리스트에서 다른 필드로 정렬을 하려면 아래의 코드에 해당 필드를 추가하세요.
// $sst = preg_match("/^(wr_subject|wr_datetime|wr_hit|wr_good|wr_nogood)$/i", $sst) ? $sst : "";
$sst = preg_match("/^(wr_datetime|wr_hit|wr_good|wr_nogood)$/i", $sst) ? $sst : "";
}

if ($sst)
$sql_order = " order by $sst $sod ";

if ($sca || $stx || count($arr_search) > 0)
{
$sql = " select distinct wr_parent from $write_table where $sql_search $sql_order limit $from_record, $board[bo_page_rows] ";
}
else
{
$sql = " select * from $write_table where wr_is_comment = 0 $sql_order limit $from_record, $board[bo_page_rows] ";
}
$result = sql_query($sql);

// 년도 2자리
$today2 = $g4[time_ymd];

$list = array();
$i = 0;

if (!$sca && !$stx && count($arr_search) == 0) {
$arr_notice = explode("\n", trim($board[bo_notice]));
for ($k=0; $k<count($arr_notice); $k++)
{
if (trim($arr_notice[$k])=='') continue;

$row = sql_fetch(" select * from $write_table where wr_id = '$arr_notice[$k]' ");

if (!$row[wr_id]) continue;

$list[$i] = get_list($row, $board, $board_skin_path, $board[bo_subject_len]);
$list[$i][is_notice] = true;

$i++;
}
}

$k = 0;

while ($row = sql_fetch_array($result))
{
// 검색일 경우 wr_id만 얻었으므로 다시 한행을 얻는다
if ($sca || $stx|| count($arr_search) > 0)
$row = sql_fetch(" select * from $write_table where wr_id = '$row[wr_parent]' ");

$list[$i] = get_list($row, $board, $board_skin_path, $board[bo_subject_len]);
if (strstr($sfl, "subject"))
$list[$i][subject] = search_font($stx, $list[$i][subject]);
$list[$i][is_notice] = false;
//$list[$i][num] = number_format($total_count - ($page - 1) * $board[bo_page_rows] - $k);
$list[$i][num] = $total_count - ($page - 1) * $board[bo_page_rows] - $k;

$i++;
$k++;
}

$write_pages = get_paging($config[cf_write_pages], $page, $total_page, "./board.php?bo_table=$bo_table".$qstr."&page=");

$list_href = '';
$prev_part_href = '';
$next_part_href = '';
if ($sca || $stx|| count($arr_search) > 0)
{
$list_href = "./board.php?bo_table=$bo_table";

//if ($prev_spt >= $min_spt)
$prev_spt = $spt - $config[cf_search_part];
if (isset($min_spt) && $prev_spt >= $min_spt)
$prev_part_href = "./board.php?bo_table=$bo_table".$qstr."&spt=$prev_spt&page=1";

$next_spt = $spt + $config[cf_search_part];
if ($next_spt < 0)
$next_part_href = "./board.php?bo_table=$bo_table".$qstr."&spt=$next_spt&page=1";
}

}
// list.php 일경우 불러오는 소스 끝
?>

답변을 작성하시기 전에 로그인 해주세요.
전체 10,637
QA 내용 검색

회원로그인

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