최신글 오류 메세지좀 도와주세요

최신글 오류 메세지좀 도와주세요

QA

최신글 오류 메세지좀 도와주세요

본문

아래처럼 나왔는데
인덱스에서이렇게 인크루드 시켰는데
<? echo latest("cook_jq", "banner|main", 4, 25, 0); //배너 ?>
아랫처럼 메세지가 나오네요
G4 스킨을 수정하는중입니다/
select * from g5_write_banner|main where wr_is_comment = 0 order by wr_num limit 0, 4
1064 : You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '|main where wr_is_comment = 0 order by wr_num limit 0, 4' at line 1
error file : /yc5/shop/index.php
 
<div id="featured" >
<div id="featured1">
<!--div class="title"><img src="<?=$g4[path]?>/img/set_title.png" /></div-->
<div style="position: absolute; width: 185px; z-index:20; left:5px; top:10px;">
</div>
 <ul class="ui-tabs-nav">
 <li style="height:0px"></li>
<? 
for ($i=0; $i<count($list); $i++) {
 $file01 = "$data_path/".urlencode($list[$i][file][0][file]);
 $file02 = "$data_path/".urlencode($list[$i][file][1][file]);
 $file03 = "$data_path/".urlencode($list[$i][file][2][file]);
 $link_01 = $list[$i][wr_link1];
 $j = $i + 1;  
 if ($j == "1") { 
 $selected='ui-tabs-selected';
 } else { 
 $selected='';}
//썸네일 생성
$thumfile = "";
    $thumb = $thumb_path.'/'.$list[$i][wr_id];
    // 썸네일 이미지가 존재하지 않는다면
    if (!file_exists($thumb)) {
        $file = $list[$i][file][0][path] .'/'. $list[$i][file][0][file];
        // 업로드된 파일이 이미지라면
        if (preg_match("/\.(jp[e]?g|gif|png)$/i", $file) && file_exists($file)) {
            $size = getimagesize($file);
            if ($size[2] == 1)
                $src = imagecreatefromgif($file);
            else if ($size[2] == 2)
                $src = imagecreatefromjpeg($file);
            else if ($size[2] == 3) 
                $src = imagecreatefrompng($file); 
            else
                break;
            $rate = $img_width / $size[0];
            $height = (int)($size[1] * $rate);
            // 계산된 썸네일 이미지의 높이가 설정된 이미지의 높이보다 작다면
            if ($height < $img_height)
                // 계산된 이미지 높이로 복사본 이미지 생성
                $dst = imagecreatetruecolor($img_width, $height);
            else
                // 설정된 이미지 높이로 복사본 이미지 생성
                $dst = imagecreatetruecolor($img_width, $img_height);
            imagecopyresampled($dst, $src, 0, 0, 0, 0, $img_width, $height, $size[0], $size[1]);
            imagejpeg($dst, $thumb_path.'/'.$list[$i][wr_id], $img_quality);
            chmod($thumb_path.'/'.$list[$i][wr_id], 0606);
        } else { //게디터에서 삽입한 이미지 뽑자ㅠㅠ
   $edit_img = $list[$i]['wr_content'];
   if (eregi("data/cheditor4/{$ym}/[^<>]*\.(gif|jpg|png|bmp)", $edit_img, $tmp)) { // data/geditor------
    $file = './' . $tmp[0]; // 파일명
    $size = getimagesize($file);
    if ($size[2] == 1)
     $src = imagecreatefromgif($file);
    else if ($size[2] == 2)
     $src = imagecreatefromjpeg($file);
    else if ($size[2] == 3) 
     $src = imagecreatefrompng($file); 
    else
     break;
    $rate = $img_width / $size[0];
    $height = (int)($size[1] * $rate);
    // 계산된 썸네일 이미지의 높이가 설정된 이미지의 높이보다 작다면
    if ($height < $img_height)
     // 계산된 이미지 높이로 복사본 이미지 생성
     $dst = imagecreatetruecolor($img_width, $height);
    else
     // 설정된 이미지 높이로 복사본 이미지 생성
     $dst = imagecreatetruecolor($img_width, $img_height);
    imagecopyresampled($dst, $src, 0, 0, 0, 0, $img_width, $height, $size[0], $size[1]);
    imagejpeg($dst, $thumb_path.'/'.$list[$i][wr_id], $img_quality);
    chmod($thumb_path.'/'.$list[$i][wr_id], 0606);
   }
     }
 }
    if (file_exists($thumb))
        $thumfile = "$thumb";
  else
  //이미지가 없으면
  $thumfile="$latest_skin_path/img/noimg.gif";
  //이미지가 아니네
        if(preg_match("/\.(swf|wma|asf)$/i","$file") && file_exists($file))
       { $thumfile = "<script>doc_write(flash_movie('$file', 'flash$i', '$img_width', '$img_height', 'transparent'));</script>"; }
?>
 <li class="ui-tabs-nav-item <?=$selected?>" id="nav-fragment-<?=$j?>"><a href="#fragment-<?=$j?>"><img src="<?=$file02?>" alt="" /></a></li>
<? }?>
 </ul></div>
<!-- First Content -->
<? 
for ($i=0; $i<count($list); $i++) {
 $file01 = "$data_path/".urlencode($list[$i][file][0][file]);
 $file02 = "$data_path/".urlencode($list[$i][file][1][file]);
  $file03 = "$data_path/".urlencode($list[$i][file][2][file]);
 $link_01 = $list[$i][wr_link1];
 $j = $i + 1;  
 if ($j == "1") { 
 $selected='ui-tabs-selected';
 } else { 
 $selected='';}
 $j = $i + 1;  
 if ($j == "1") { 
 $hide='';
 } else { 
 $hide='ui-tabs-hide'; }
?>
<div id="fragment-<?=$j?>"  class="ui-tabs-panel <?=$hide?>" style="background:url(<?php echo $file03 ?>)">
<div style="width: 940px; height: 350px; margin:0 auto; position: relative; z-index: 3;">
<a href='<?=$link_01?>'><img src="<?=$file01?>" alt="" width="940" height="350" /></a>
</div></div>
    <? }?>
</div>
</div>
어렵네요
G5d용으로 수정하려면..대략 어느정도 비용이? ㅠㅠ

이 질문에 댓글 쓰기 :

답변 3

G4에서 쓰던거 그대로 복사해온겁니다 <--- 그것은 G4 그대로 사용하고 G5 latest.lib.php에
G4 latest.lib 것을 복사해서 붙여넣고 latest2(~~~) 처럼 이름을 바꾸세요
출력할때는<? echo latest2("cook_jq", "banner|main", 4, 25, 0); //배너 ?>


1.
소스코드를 복사해서 g5 latest.lib에 붙여넣기 한 후 붙여넣은 function latest(~~)를 function latest2(~~)로 변경,
코드중 $g4는 모두 $g5로 변경, $latest_skin_path를 g5것을 복사
---------------------------
2.
g4  latest.lib,php를 화일명 latest.lib2.php로 변경하여 extend 폴더에 넣고
function latest(~)를 function latest2(~~)로 변경, 코드 부분 위와 같이 변경

위 두가지 중 한가지 방법으로 하세요

latest.skin 해당스킨 상단
<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가

$img_width =940; //큰 썸네일 가로
$img_height = 400; //큰 썸네일 세로
$img_quality = 100; //썸네일 퀄리티

$data_path = G5_DATA_PATH."/file/$bo_table";
$thumb_path = $data_path.'/thumb_big4';
$ym = date("ym", G5_SERVER_TIME);

@mkdir($thumb_path, 0707);
@chmod($thumb_path, 0707);

//코멘트와 리플글은 제외
$sql = " select * from $tmp_write_table
where wr_comment = '' and wr_reply = ''
order by wr_id DESC LIMIT 0, 1 ";
$result = sql_query($sql);
$last_con = sql_fetch_array($result);
?>

==========================================

출력//
 
<? echo latest2("cook_jq", "banner|main", 4, 25, 0); //배너 ?>
 
//이렇게 했고요
 
 
 
=========================================
 
g5 latest.lib에

g4 latest.lib소스 복사 추가
 
 
 
function latest2로 수정
 
$g4를 $g5로 수정
 
latest_skin_path 부분을

$latest_skin_path = G5_SKIN_PATH.'/latest/'.$skin_dir;
 $latest_skin_url = G5_SKIN_URL.'/latest/'.$skin_dir; 로수정
 
 
 
=====================  g5 latest.lib 내용  ============================
 



<!--g4스킨용 최신글 추출-->
<?
if (!defined('_GNUBOARD_')) exit;
 
// 최신글 추출
function latest2($skin_dir="", $bo_table, $rows=10, $subject_len=40, $options="")
{
 global $g5;
 
$a = explode("|", $bo_table);
 $bo_table = $a[0];
 $ca_name = $a[1];
 

$latest_skin_path = G5_SKIN_PATH.'/latest/'.$skin_dir;
 $latest_skin_url = G5_SKIN_URL.'/latest/'.$skin_dir;
 
$sql = " select * from $g5[board_table] where bo_table = '$bo_table'";
 $board = sql_fetch($sql);
 
$tmp_write_table = $g5['write_prefix'].$bo_table;
 $where = "where wr_is_comment=0";
 if ($ca_name) $where .= " and ca_name='$ca_name'";
 $sql = " select * from $tmp_write_table $where order by wr_num limit 0, $rows ";
 
$result = sql_query($sql);
 $list = array();
 for ($i=0; $row = sql_fetch_array($result); $i++)
 $list[$i] = get_list($row, $board, $latest_skin_path, $subject_len);
 
ob_start();
 include "$latest_skin_path/latest.skin.php";
 $content = ob_get_contents();
 ob_end_clean();
 
return $content;
}
?>
 
 
 
<?php
if (!defined('_GNUBOARD_')) exit;
 
// 최신글 추출
// $cache_time 캐시 갱신시간
function latest($skin_dir='', $bo_table, $rows=10, $subject_len=40, $cache_time=1)
{
    global $g5;
    //static $css = array();
 
    if (!$skin_dir) $skin_dir = 'basic';
 
    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_once($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 = "<?php\nif (!defined('_GNUBOARD_')) exit;\n\$bo_subject=\"".$bo_subject."\";\n\$list=".var_export($list, true)."?>";
            fwrite($handle, $cache_content);
            fclose($handle);
        }
    }
 
   

    ob_start();
    include $latest_skin_path.'/latest.skin.php';
    $content = ob_get_contents();
    ob_end_clean();
 
    return $content;
}
?>
 
 
 
 
 
===============/extend폴더에 들어갈 latest.lib2.php 내용
 
위 수정한 G4부분 복사해서 넣고 latest.lib2.php 로 저장해서 넣음
 
 
 
 
 
근데...아무것도 안나오네요.
 
영카트5 메인에 출력하는건데요..

테이블 이름에 특수문자가 들어가서 그런듯 합니다.
g5_write_banner|main  <<== "|" <<== 이거 때문에 에러난듯 합니다.
 
테이블 이름이 " g5_write_banner|main " 이게 정말 맞습니다.

테이블 이름이 banne인데요 G4때 저렇게 출력했는데
G5는
g5_write_<==이걸 써줘야 하나요?
|는 카테고리구분하는 문자인데요
banner테이블 main 이라는 카테고리 불러오는..
G4에서는 저렇게 출력해서

|는 카테고리구분하는 문자 , 즉 테이블 이름과 무관하면
 
그러면 쿼리문에 " | 카테고리" 를 쓰시면 당연히 에러가 납니다.
from 과 where 사이에는 테이블 이름만 쓰셔야 합니다.

G5뿐 아니라 G4도 마찬가지일텐데요.
MySQL 쿼리문에 FROM과 WHERE 사이에 "테이블이름|다른단어" 가 들어가면 에러 납니다.

이건 어짜피 같은  MySQL을 쓰는거라 MySQL에 G4도 쓰고 G5도 쓸수 있으니 차이가 없습니다.
아마 소스가 잘못된듯 싶네요.

답변을 작성하시기 전에 로그인 해주세요.
전체 1

회원로그인

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