스킨수정 조언 부탁드립니다.

스킨수정 조언 부탁드립니다.

QA

스킨수정 조언 부탁드립니다.

답변 3

본문

아래 하단 소스가 모바일 최근게시물 불러오는 소스입니다.
전체 게시판이 아닌 지정된 게시판만 불러올순 없을까요? 2개 이상이 아닌 1개 지정된 게시판으로 불러와도 상관없습니다.
<?
for($i=0;$i<count($list);$i++){
    $list_selected=$nbsp=$wr_comment="";
    $list[$i]['subject'] = conv_subject($list[$i]['wr_subject'], $subject_len, "…");
    if($wr_id==$list[wr_id]) $list_selected="class='list_selected'";
    $reply = $list['wr_reply'];
    if($list[$i][wr_reply]){
        for ($k=0; $k<strlen($reply); $k++) $nbsp.= '  ';
        $list[$i]['subject']=$nbsp."[re]".$list['subject'];
    }
    if($list[$i][wr_comment]){
        $cmt=sql_fetch("select wr_datetime from ".$g4[write_prefix].$list[$i][bo_table]." where wr_is_comment=1 and wr_parent='$list[$i][wr_id]' order by wr_datetime desc");
        if ($cmt[$i]['wr_datetime'] >= date("Y-m-d H:i:s", $g4['server_time'] - 86400)) 
            $wr_comment="<span class='list_cmt_cnt_new'>{$list[$i][wr_comment]}</span>";
        else $wr_comment="<span class='list_cmt_cnt'>{$list[$i][wr_comment]}</span>";
    }
    $icon_secret = "";
    $contents = $list[$i][wr_subject];
    if (strstr($list['wr_option'], "secret")){
        $icon_secret = "<img src='$g4[path]/images/icon_secret.gif' align='absmiddle'>";
        $contents="비밀글입니다.";
    }
    $icon_new = "";
    if ($list[$i]['wr_datetime'] >= date("Y-m-d H:i:s", $g4['server_time'] - ($board['bo_new'] * 3600)))
        $icon_new = "<img src='$g4[path]/images/icon_new.gif' align='absmiddle'>";
?>
<li><a href="<?=$g4[path]?>/view.php?bo_table=<?=$list[$i][bo_table]?>&wr_id=<?=$list[$i][wr_id]?>&page=<?=$page?>">
    <h3><?=$list[$i][subject]?> <?if($wr_comment){?><span class="ui-li-count"><?=$wr_comment?></span><?}?></h3>
    <p><?=$list[$i][bo_subject]?> / <strong><?=$list[$i][wr_name]?></strong> / <?=date("Y-m-d",strtotime($list[$i][wr_datetime]))?></p>    </a>    
</li>
    <?}?>
</ul>

이 질문에 댓글 쓰기 :

답변 3

아예 $cmt=sql_fetch("select wr_datetime from ".$g4[write_prefix].$list[$i][bo_table]." where wr_is_comment=1 and wr_parent='$list[$i][wr_id] and bo_table='사용자가 원하는 테이블 명' order by wr_datetime desc"); 이 부분이 수정이 아니라 다 삭제해도 전체게시판 최근이 나오는데요 찾을수가 없네요 휴
 $cmt=sql_fetch("select wr_datetime from ".$g4[write_prefix].$list[$i][bo_table]." where wr_is_comment=1 and wr_parent='$list[$i][wr_id]' order by wr_datetime desc");
 
 
데이터베이스 쿼리문을 수정하면 됩니다..
 
 $cmt=sql_fetch("select wr_datetime from ".$g4[write_prefix].$list[$i][bo_table]." where wr_is_comment=1 and wr_parent='$list[$i][wr_id] and bo_table='사용자가 원하는 테이블 명' order by wr_datetime desc");

답글 감사합니다. 근데 여전히 밑에 부분으로 수정해도 모든 게시판의 최신글만 나오는데요 한번더 봐주실 수 있을까요 가능하면 1개만 불러오는방법, 지정된 2개 불러오는방법으로 설명 부탁드립니다.

$cmt=sql_fetch("select wr_datetime from ".$g4[write_prefix].$list[$i][bo_table]." where wr_is_comment=1 and wr_parent='$list[$i][wr_id]' order by wr_datetime desc");
 
 
----------------------------------------------------------------------------------
 
부분에서 보시면... 스킨은 어떠한 게시판에 지정하면 나오는 형식으로 되어있기 때문에, bo_table 이라는 게시판 이름을 추가해줬던 겁니다... ㅎㅎ... 방금 전게 안됬다면 다음과 같은 방식도 가능하겟군요...
$cmt=sql_fetch("select wr_datetime from ".$g4[write_prefix].$list[$i][bo_table]." where wr_is_comment=1 and wr_parent='$list[$i][wr_id]' order by wr_datetime desc");
 
이 데이터베이스 구문에서 살펴보면 from 절에 .$g4[write_prefix].$list[$i][bo_table]. 과 같이 되어있는데, 이 구문에 g4_ 로 시작하는 write_게시판이름 입니다....
그러니까.... 이렇게 해주면 되겟군요
 
.$g4[write_prefix].$list[$i][게시판 이름]. 과 같이 바꾸면 1개의 게시판 형태가 가능하구요... 이 형식이 복잡하다고 생각하시면...
 
mysql 로 접속하셔서 다음과 같이 해보시면 됩니다.
 
$mysql -u 유저명 -p
이 상태면 해당 데이터베이스에 접속됬을 껍니다..
$show databases;
로 하면 사용하시는 데이터베이스 명들이 나올꺼구요
$use 데이터베이스명;
하면 해당 데이터베이스 명이 선택됩니다
 
$show tables;
이러면 테이블 명들이 나올텐데... 여기서 게시판의 이름을 보고 수정해주시면 됩니다
예를들어 게시판 테이블 이름이, g4_write_sub4_1 과 같다면 쿼리문을 이렇게 수정해주면 됩니다
 
게시판 테이블 한개만 조회할 경우,
$cmt=sql_fetch("select wr_datetime from g4_write_sub4_1 where wr_is_comment=1 and wr_parent='$list[$i][wr_id]' order by wr_datetime desc");
 
2개 조회할 경우,
$cmt=sql_fetch("select wr_datetime from g4_write_sub4_1, g4_write_sub4_2 where wr_is_comment=1 and wr_parent='$list[$i][wr_id]' order by wr_datetime desc");
 
원래 from 절에 사용하는 테이블명의 2개 종류는... 조인을 사용할 때 사용합니다.
만약 2개의 문법이 안될경우 내부조인, 외부조인 등등 조인에 관련된 사항을 검색하여 참조하세요

으 제가 겨우 설치만해놓고 붙여놓기 수준밖에 안되서 이해를 잘 못합니다.
if($list[$i][wr_comment]){
$cmt=sql_fetch("select wr_datetime from ".$g4[write_prefix].$list[$i][bo_table]." where wr_is_comment=1 and wr_parent='$list[$i][wr_id]' order by wr_datetime desc");
이 부분을 아예 몽땅 삭제해도 떠버리는데 한번더 봐주실 수 있을까요

그 부분을 몽땅 삭제해버리면 안된답니다...

$cmt 에 해당하는 sql_fetch 함수는... 모든 테이블들을 기준으로 sql 쿼리문을 작성하고 있기 때문에 삭제하는 것이 아니라 제가 답변한 것처럼 변경을 해야하지요

$cmt=sql_fetch("select wr_datetime from ".$g4[write_prefix].$list[$i][bo_table]." where wr_is_comment=1 and wr_parent='$list[$i][wr_id]' order by wr_datetime desc");

에서 나오게 하고 싶은 게시판명이 photo 입니다.

$cmt=sql_fetch("select wr_datetime from ".$g4[write_prefix].$list[$i][photo]." where wr_is_comment=1 and wr_parent='$list[$i][wr_id]' order by wr_datetime desc");

로 변경해도 글이 다 나옵니다. 제가 이해를 못하는건지....

그리고 위에 그 내용을 몽땅삭제해도 모든 글이 출력됩니다....

한번더 답변 좀 부탁드릴게요

$cmt=sql_fetch("select wr_datetime from ".$g4[write_prefix].$list[$i][photo]." where wr_is_comment=1 and wr_parent='$list[$i][wr_id]' order by wr_datetime desc");

가 아니라 요렇게 해야죠!


$cmt=sql_fetch("select wr_datetime from g4_write_photo where wr_is_comment=1 and wr_parent='$list[$i][wr_id]' order by wr_datetime desc");

답변을 작성하시기 전에 로그인 해주세요.
QA 내용 검색
질문등록
전체 21
© SIRSOFT
현재 페이지 제일 처음으로