채택완료

엑셀로 게시판 다운로드 및 그룹내 모든 게시판 다운로드 같은것은 어떻게 해야 하나요?

2017-12-29 (금) 19:10:23 2,269

엑셀다운로드 하는 방법에 대해서 많은 팁들을 공부중입니다. 찾아보고 성공한 것들중에 

https://sir.kr/qa/202218 조민님이 남겨주신 팁을 먼저 알려드리자면 보고 있는 페이지가 필요한 필드명만 선택하여 저장되는 팁입니다.

Copy
<?

ob_start();

include_once($_SERVER['DOCUMENT_ROOT'] ."/common.php");

 

header("Content-type:application/vnd.ms-excel");

header("Content-Disposition:attachment;filename=view.xls");

 

$is_title="엑셀 문서 다운로드";

 

$bo_table=$_GET['bo_table'];

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

 

 

$sql="select * from g5_write_".$bo_table." where wr_is_comment=0 and wr_id='{$wr_id}'";

$is_print=sql_fetch($sql);

?>

<!doctype html>

<html lang="ko">

<head>

<meta charset="UTF-8">

<style type="text/css">

.txt {mso-number-format:'\@'}

</style>

<title><?=$is_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>

 

 

위에 소스를 excel_view.php 이름으로 저장후 사용중인 게시판 스킨 폴더안으로 업로드를 합니다. 

게시판 스킨 폴더 > view_skin.php 파일 소스 적당한 자리를 선택후 아래의 링크를 추가해 보세요.

 

<a href="<?=$board_skin_url?>/excel_view.php?bo_table=<?=$bo_table?>&wr_id=<?=$view['wr_id']?>">엑셀보기</a>

이것을 현재 보고 있는 게시판 전체

또는

그룹 전체에 적용하고자 하는데 고수님들 도움 좀 부탁드립니다.

여기에 정리해두면 아마 많은 분들께 도움될것입니다.

감사합니다.

|

답변 1개

채택된 답변
+20 포인트
2017-12-31 (일) 19:02:36

sql 을 그룹으로 검색해서 뽑아내면 되지 않을까요?

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