[G4] 게시판 엑셀다운로드 > 기술자료 | 해피정닷컴

[G4] 게시판 엑셀다운로드 > 기술자료

본문 바로가기

사이트 내 전체검색

[G4] 게시판 엑셀다운로드 > 기술자료

그누보드 [G4] 게시판 엑셀다운로드

페이지 정보


본문

막장코더( w3holic ) 님이 올려주신 내용을 조금 정리해보았습니다. 
원본 : http://sir.co.kr/g4_skin/81864 
참고 : http://sir.co.kr/bbs/board.php?bo_table=g4_skin&wr_id=92624 


변경된내용 
①. excel.php  설정을 변경하지 않아도 가능하도록 변경했습니다. 
②. 디비설정을  그누의  dbconfig.php 와 연동되도록 변경했습니다. 


1. 그누보드4 / skin / board / basic / _common.php 생성 
<?php 
include_once "../../../common.php"; 
?> 


2. 그누보드4 / skin / board / basic / list.skin.php  적절한 위치에 아래 코드 추가 
<?php if ($admin_href) { ?><a href='<?php echo $board_skin_path; ?>/excel.php?bo_table=<?php echo $bo_table; ?>' target='_blank'>Excel</a><?php } ?> 


3. 그누보드4 / skin / board / basic / excel.php  파일 생성 
<?php
include_once "_common.php";
if (!$is_admin) {
    alert("관리자만 접근 가능합니다.");
    exit;
}

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

include_once "_common.php";
//@mysql_query("SET CHARACTER SET utf8");  // 한글깨지면 주석해지

if ($ms =="excel"){
    $g4[title] = "엑셀 문서 다운로드";
    header( "Content-type: application/vnd.ms-excel" );
    header( "Content-Disposition: attachment; filename=상품구매.xls" );
    //header( "Content-Description: PHP4 Generated Data" );
} else if ($ms =="power"){
    $g4[title] = "파워포인트 문서 다운로드";
    header( "Content-type: application/vnd.ms-powerpoint" );
    header( "Content-Disposition: attachment; filename=상품구매.ppt" );
    // header( "Content-Description: PHP4 Generated Data" );
} else if ($ms =="word"){
    $g4[title] = "워드 문서 다운로드";
    header( "Content-type: application/vnd.ms-word" );
    header( "Content-Disposition: attachment; filename=상품구매.doc" );
    //header( "Content-Description: PHP4 Generated Data" );
} else if ($ms =="memo"){
    $g4[title] = "메모 문서 다운로드";
    header( "Content-type: application/vnd.ms-notepad" );
    header( "Content-Disposition: attachment; filename=상품구매.txt" );
} else {
    header( "Content-type: application/vnd.ms-excel" );
    header( "Content-Disposition: attachment; filename=상품구매.xls" );
}
header( "Content-Description: PHP4 Generated Data" );

// 원글 + 코멘트 다운로드
$temp=sql_fetch_array(sql_query("select count(*) from {$excel_down} "));
$result=sql_query("select * from {$excel_down} order by wr_datetime desc");

// 원글만 다운로드 (코멘트 제외) ,  2013-10-21 추가
//$temp=sql_fetch_array(mysql_query("select count(*) from {$excel_down} where wr_is_comment = '0' and wr_content = '{$wr_id}' "));
//$result=sql_query("select * from {$excel_down} where wr_is_comment = '0'  and wr_content = '{$wr_id}' order by wr_datetime desc"); 

$number=$temp[0];
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css">
.txt {mso-number-format:'\@'}
</style>
</head>

<body>
<table>
    <tr>
        <td>번호</td>
        <td>제목</td>
        <td>아이디</td>
        <td>이름</td>
        <td>작성일</td>
        
        <td>필드1</td>
        <td>필드2</td>
        <td>필드3</td>
        <td>필드4</td>
        <td>필드5</td>
        <td>필드6</td>
        <td>필드7</td>
        <td>필드8</td>
        <td>필드9</td>
        <td>필드10</td>
    </tr>

<?php
while($data=sql_fetch_array($result)) {
    echo "
    <tr>
        <td>{$number}</td>
        <td>{$data['wr_subject']}</td>
        <td>{$data['mb_id']}</td>
        <td>{$data['wr_name']}</td>
        <td class='txt'>{$data['wr_datetime']}</td>
        
        <td class='txt'>{$data['wr_1']}</td>
        <td class='txt'>{$data['wr_2']}</td>
        <td class='txt'>{$data['wr_3']}</td>
        <td class='txt'>{$data['wr_4']}</td>
        <td class='txt'>{$data['wr_5']}</td>
        <td class='txt'>{$data['wr_6']}</td>
        <td class='txt'>{$data['wr_7']}</td>
        <td class='txt'>{$data['wr_8']}</td>
        <td class='txt'>{$data['wr_9']}</td>
        <td class='txt'>{$data['wr_10']}</td>
    </tr>
    ";
    $number--;
}
?>
</table>
</body>
</html>

댓글목록

등록된 댓글이 없습니다.


Total 2,633건 1 페이지
  • RSS
기술자료 목록
2633
MySQL   275  2024-03-29 14:14 ~ 2024-03-29 14:14  
2632
그누보드   603  2024-02-23 18:40 ~ 2024-02-24 06:13  
2631
JavaScript   617  2024-02-16 18:50 ~ 2024-02-16 20:37  
2630
Java   543  2024-02-06 16:49  
2629
PHP   695  2024-02-06 16:42  
2628
호스팅   663  2024-01-29 12:54  
2627
PHP   780  2024-01-26 11:04 ~ 2024-01-26 11:13  
2626
MySQL   1005  2024-01-08 17:37 ~ 2024-03-14 16:00  
2625
SQL   984  2024-01-08 12:36  
2624
영카트   1160  2024-01-04 14:57  
2623
일반   2039  2023-12-15 18:33  
2622
Android   1615  2023-11-30 18:48 ~ 2023-11-30 19:41  
2621
전자결제   2853  2023-11-23 19:53  
2620
PHP   2114  2023-11-20 10:56 ~ 2023-11-20 11:14  
2619
Linux   1900  2023-11-09 19:55  
2618
그누보드   1886  2023-11-06 20:38  
2617
Linux   1853  2023-11-01 21:41 ~ 2023-11-02 10:30  
2616
영카트   1929  2023-10-07 23:31  
2615
SNS   2906  2023-09-24 17:56  
2614
ClassicASP   2630  2023-09-14 08:38  

검색

해피정닷컴 정보

회사소개 회사연혁 협력사 오시는길 서비스 이용약관 개인정보 처리방침

회사명: 해피정닷컴   대표: 정창용   전화: 070-7600-3500   팩스: 042-670-8272
주소: 서울센터 (08393) 서울시 구로구 디지털로32가길 16 파트너스타워2차 1206-280호
        대전센터 (34368) 대전시 대덕구 대화로 160 대전산업용재유통단지 지원1동 205호
개인정보보호책임자: 정창용   사업자번호: 119-05-36414
통신판매업신고: 2014-서울구로-0074 [사업자등록확인]  
Copyright 2001~2024 해피정닷컴. All Rights Reserved.