채택완료

여유필드값 최신글에 출력문의

2014-09-19 (금) 19:42:16 4,368

안녕하세요 도움을좀 받고자 이렇게 글 올리네요 아시는분 답변좀 부탁드립니다. 

latest.skin.php 에 보면 글쓴이 출력시 {$list[$i]['wr_name']}  이렇게 되어 있고 정상적으로 게시판 아니 메인페이지로
출력이 됩니다.
그런데 여유필드를통해 저장된 wr_2 에 정보는   {$list[$i]['wr_2']}​ 이렇게 해도 출력이 안되네요.

그래서  정보를 찾아보니  lib/latest.lib.php 에서 w_2 을 추가해주면 된다하여 추가해도 역시 최신글에는 출력이 안됩니다.

$list[$i]['wr_2'] 대가로를 빼고 넣어 봤더니 Array['wr_2']​ 이렇게 출력 됩니다.

wr_2 로 받은 값들은 게시판에서는 정상적으로 잘 출력 됩니다.
게시판이 아닌 메인으로 출력시에만 값이 노출되지 않고 있습니다.

latest.skin.php​   파일과   latest.lib.php ​ 파일을 정상적으로 처리한건지 한번 봐주셨으면 합니다..

//--------------------latest.skin.php​​ ------------------//

Copy
​<?if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가 ?>
 
<div class="latestList h2bg"> <ul class="btnPage">  <li><a href="<?=$g4[bbs_path]?>/board.php?bo_table=<?=$bo_table?>"></a></li> </ul> <ul class="text">  <? for ($i=0; $i<count($list); $i++) {    
  ?>  <li>   <?            echo $list[$i]['icon_reply'];            echo "<!---<a href='{$list[$i]['href']}'>--->";            if ($list[$i]['is_notice'])                echo "<strong>{$list[$i]['wr_name']}</strong>";            else if($list[$i][wr_is_comment])    echo cut_str(get_text(strip_tags($list[$i][wr_content])),$subject_len,"…");            else
// 관리자 if ($is_admin) {     echo $list[$i]['name']; } else { // 기타 
 " <table><tr> <td width='250' align='left'>$list[$i]['wr_2']</td> <td width='100' align='left'></td>    <td width='160' align='right'><span style='font-size:8pt; color:#999999;text-align:right;'> {$list[$i]['datetime2']} </span></td> </tr></table> ";
}             echo "<!---</a>--->";
            //if ($list[$i]['comment_cnt'])                 //echo " <a href=\"{$list[$i]['comment_href']}\"><span class='cmt'>{$list[$i]['comment_cnt']}</span></a>";
            // if ($list[$i]['link']['count']) { echo "[{$list[$i]['link']['count']}]"; }            // if ($list[$i]['file']['count']) { echo "<{$list[$i]['file']['count']}>"; }
            //echo " " . $list[$i]['icon_new'];            //echo " " . $list[$i]['icon_file'];            //echo " " . $list[$i]['icon_link'];            //echo " " . $list[$i]['icon_hot'];            //echo " " . $list[$i]['icon_secret'];            ?>  </li>  <? } ?>  <? if (count($list) == 0) { ?><li>게시물이 없습니다.</a></li><? } ?>
 </ul></div>

//--------------------latest.lib.php​ ------------------//

Copy
​<?if (!defined('_GNUBOARD_')) exit;
// 최신글 추출function latest($skin_dir="", $bo_table, $rows=10, $subject_len=40, $options=""){    global $g4;
    if ($skin_dir)        $latest_skin_path = "$g4[path]/skin/latest/$skin_dir";    else        $latest_skin_path = "$g4[path]/skin/latest/basic";
    $list = array();
    $sql = " select * from $g4[board_table] where bo_table = '$bo_table'";    $board = sql_fetch($sql);
    $tmp_write_table = $g4['write_prefix'] . $bo_table; // 게시판 테이블 전체이름    //$sql = " select * from $tmp_write_table where wr_is_comment = 0 order by wr_id desc limit 0, $rows ";    // 위의 코드 보다 속도가 빠름    //$sql = " select * from $tmp_write_table where wr_is_comment = 0 order by wr_num limit 0, $rows ";
// 위의 코드 보다 속도가 빠름 $sql = " select wr_id, wr_subject, wr_option, wr_content, wr_2, wr_comment, wr_parent, wr_datetime, wr_last, wr_homepage, wr_name, wr_reply, wr_link1, wr_link2, ca_name, wr_hit from $tmp_write_table where wr_is_comment = 0 order by wr_num limit 0, $rows "; 
    //explain($sql);    $result = sql_query($sql);    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;} ?>​

​
​​​

|

답변 3개 / 댓글 1개

채택된 답변
+20 포인트

echo 명령어가 잇어야 출력을 하죠


30, 36 행 삭제

 

32행

<td width='250' align='left'><?=$list[$i]['wr_2']?></td>


 


 34행


    <td width='160' align='right'><span style='font-size:8pt; color:#999999;text-align:right;'> <?=$list[$i]['datetime2']?> </span></td>

답변에 대한 댓글 1개

그렇게 했다면 27행은 28행처럼
{$list[$i][wr_2]}

​$sql = " select * from $tmp_write_table where wr_is_comment = 0 order by wr_num limit 0, $rows "; 

select 와 from 사이에 넣어준 필드명들 다 지우시고 * 넣어주시고,

print_r($list);  한번출력해보세요. 재대로 값이 배열에 담겨져 있는지 확인먼저해보세요. 

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