그누보드4 게시글+댓글 엑셀다운로드

2022-05-16 (월) 19:06:33 2,731

안녕하세요.

그누보드4에서 특정게시판의 특정게시글+댓글을 엑셀 다운로드 작업을 하려합니다.

아래 두분의 링크를 참고하여 제작해보았는데요.

https://sir.kr/bbs/board.php?bo_table=g4_tiptech&wr_id=24559

https://sir.kr/qa/202218

다운로드를 하게되면 테이블에 제목외에 $is_print 부분의 데이터가 아무것도 들어가지 않은 상태로 다운되네요..
 

잘못된 부분이 있는지 고수님들의 도움 부탁드리겠습니다.

감사합니다.
 

[view.skin.php]

Copy
<a href='<?php echo $board_skin_path; ?>/excel_view.php?bo_table=<?php echo $bo_table; ?>&wr_id=<?php $view['wr_id']; ?>' target='_blank'>Excel</a>

[excel_view.skin.php]

Copy
<?php
ob_start();
include_once "_common.php";

header( "Content-type: application/vnd.ms-excel" );
header( "Content-Disposition: attachment; filename=상담일지.xls" );

$excel_down = $g4['table_prefix'] . $_GET['bo_table']; //엑셀 다운로드 테이블
$wr_id = $id = $_GET['wr_id'];

$g4[title] = "엑셀 문서 다운로드";

$bo_table=$_GET['bo_table'];
$wr_id=(int)$_GET['wr_id'];

$sql="select * from g4_write_".$bo_table." where wr_id='{$wr_id}'";
$view=sql_fetch($sql);

?>

<!doctype html>
<html lang="ko">
<head>
<meta charset="UTF-8">
<style type="text/css">
.txt {mso-number-format:'\@'}
</style>
<title><? echo $g4[title]; ?></title>
</head>

<body>
    <table>
        <tr>
        <th scope="col">번호</th>
        <th scope="col">글쓴이</th>
        <th scope="col">제목</th>
        <th scope="col">글내용</th>
        <th scope="col">조회수</th>
        <th scope="col">날짜</th>
        </tr>

        <tr>
        <td class='txt'><?=$is_print['wr_id']?></td>
        <td class='txt'><?=$is_print['wr_name']?></td>
        <td class='txt'><?=$is_print['wr_subject']?></td>
        <td class='txt'><?=$is_print['wr_content']?></td>
        <td class='txt'><?=$is_print['wr_hit']?></td>
        <td class='txt'><?=$is_print['wr_datetime']?></td>
        </tr>
    </table>
</body>
</html>

답변 3개 / 댓글 3개

2022-05-16 (월) 21:10:11

위에 $view로 하셔서 is_print 대신 view로 해보시면 될거 같습니다.

답변에 대한 댓글 1개

답변감사드립니다!
$view로 변경해도 동일하네요ㅜ

https://sir.kr/gujik/1290 에 저의 연락처가 있습니다

핸드폰으로 연락주시면 같이 고민 해드릴게요

2022-05-16 (월) 19:26:16

$is_print 

대신에

$view

라고 써 보세요.

답변에 대한 댓글 2개

답변감사드립니다!
$view로 변경해도 동일하네요ㅜ
$sql="select * from g4_write_".$bo_table." where wr_id='{$wr_id}'";
$view=sql_fetch($sql);
print_r( $view);
//해서 결과가 나와야 합니다. 안 나오면다면 wr_id값을 빠뜨린 것 같군요.

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