묻고답하기

http://www.xpressengine.com/?_filter=search&mid=tip&search_keyword=datetime&search_target=comment&document_srl=18207088

위 팁을 참고 삼아서 아래와 같이 게시판 목록을 엑셀출력하는 것을 만들었습니다.






 <!-- 기본 변수 -->
<?
$connect_host        = "localhost";
$connect_id        = "DB아이디";
$connect_pass        = "DB접속암호";
$connect_db        = "DB명";
$connect_table        = "xe_documents";
$xls_filename        = "filename.xls";

$connect=@mysql_connect($connect_host,$connect_id,$connect_pass);
@mysql_query("set character set utf8"); // 한글 입출력 문제 해결을 위해..
$mysql=@mysql_select_db($connect_db,$connect);

header("Content-Type: application/vnd.ms-excel");
header("Content-Disposition: attachment; filename=$xls_filename");
?>

<html>
<head>
<meta http-equiv=Content-Type content=text/html; charset=utf-8>
<meta http-equiv=Content-Type content=text/html; charset=EUC-KR>
</head>
<body leftmargin="0" marginwidth="0" topmargin="0" marginheight="0">

<table border="1" cellspacing="0" cellpadding="0" style="border-collapse: collapse">
<tr align=center>
<?
$fields = mysql_query("select category_srl, document_srl, title, regdate, user_name from $connect_table where module_srl=61 order by regdate desc");
$columns = mysql_num_fields($fields);
for ($i = 0; $i < $columns; $i++) {
$field[$i]=mysql_field_name($fields, $i);
echo "<th style='FONT-FAMILY:tahoma; FONT-SIZE:8pt; Padding: 2 2 2 2;'>".$field[$i]. "</th>";
}
?>
</tr>

<?
/*$result=mysql_query("select * from $connect_table where module_srl=61 order by document_srl, regdate ");*/
$result=mysql_query("select category_srl, document_srl, title, regdate, user_name from $connect_table where module_srl=61 order by regdate desc");
while($data=mysql_fetch_assoc($result)){
echo"<tr>";
for ($i = 0; $i < sizeof($field); $i++) {
echo "<td style='FONT-FAMILY:tahoma; FONT-SIZE:8pt; Padding: 2 2 2 2;'>".$data["$field[$i]"]."</td>";
}
echo"</tr>";
}
?>

</table>
</body>
</html>


그리고 댓글 참고해서 확장 변수만을 목록으로 하여 엑셀로 출력하는 것도 만들었고요.




 <!-- 확장 변수 -->
<?
$connect_host        = "localhost";
$connect_id        = "DB아이디";
$connect_pass        = "DB접속암호";
$connect_db        = "DB명";
$connect_table        = "xe_document_extra_vars";
$xls_filename        = "filename_var.xls";

$connect=@mysql_connect($connect_host,$connect_id,$connect_pass);
@mysql_query("set character set utf8"); // 한글 입출력 문제 해결을 위해..
$mysql=@mysql_select_db($connect_db,$connect);

header("Content-Type: application/vnd.ms-excel");
header("Content-Disposition: attachment; filename=$xls_filename");
?>

<html>
<head>
<meta http-equiv=Content-Type content=text/html; charset=utf-8>
<meta http-equiv=Content-Type content=text/html; charset=EUC-KR>
</head>
<body leftmargin="0" marginwidth="0" topmargin="0" marginheight="0">

<table border="1" cellspacing="0" cellpadding="0" style="border-collapse: collapse">
<tr align=center>
<?
$fields = mysql_list_fields("$connect_db", "$connect_table");
$columns = mysql_num_fields($fields);
for ($i = 0; $i < $columns; $i++) {
$field[$i]=mysql_field_name($fields, $i);
}
?>

<tr>
<td>항목A</td>
<td>항목B</td>
<td>항목C</td>
<td>항목D</td>
<td>항목E</td>
<td>항목F</td>
<td>항목G</td>
</tr>

<?
/*$result=mysql_query("select * from $connect_table");*/
$result=mysql_query("select * from $connect_table where module_srl=61 order by document_srl, var_idx");
$ctmp = 1;
echo "<tr>";
while($data=mysql_fetch_assoc($result)){
for ($i = 4; $i < sizeof($field); $i=$i+5) {
echo "<td><span style='FONT-FAMILY:tahoma; FONT-SIZE:8pt;'>".$data["$field[$i]"]."</td>";
if($ctmp%7 == 0) // 확장변수 수만큼 값을 넣으세요.
{
echo "</tr>";
if($i+5<sizeof($field)){
echo "<tr>";
}
}
$ctmp = $ctmp + 1;
}
}
?>

</table>
</body>
</html>



1. 카테고리, 문서번호가 srl값으로 나타나는는데 실제 게시판에 나타나는것과 같은 문자열로 출력하는 방법은?
2. 위 2개의 소스를 하나로 합칠수 있는... 그러니까 기본정보와 확장변수를 한페이지에 표현하는 방법은?


위 두개 질문 올립니다.
글쓴이 제목 최종 글
XE 공지 글 쓰기,삭제 운영방식 변경 공지 [16] 2019.03.05 by 남기남
Jhope 웹진형에서 확장변수 보이기. [2] 2009.03.20 by Jhope
상오기 body 태그는 어디에서 수정해야 하나요? [2] 2009.03.20 by 상오기
MEGAMIX 업데이트 후 글,댓글 작성시 에러 도와주세요!!! file  
jih449 그룹 이미지 지정을하면 오류가 좌르륵 뜹니다. 한번 봐주세요. file  
bluesunwon 글쓴사람 아이디클릭시 쪽지보내기 질문!! [1] 2009.03.20 by 궁금이2
에디터 Xquared 로 변경은 어떻게 하나요? [1] 2009.03.20 by 궁금이2
야야곰 사냥꾼 제 사이트에 회원가입이 안됩니다. 누가 아시는분 있어요. [2] 2009.03.20 by 느까끼
대부 RSS로 받는 데이터를 게시판에 자동으로 포스팅 할려면  
Kamina 게시물 내용을 바로 보는 방법 (며칠째잠을못자요 제발 도와주세요ㅠㅠ)  
유팔복 [문의드립니다][꾸벅]EXIF 출력 스킨있잔아요... [4] 2009.03.20 by Reminisce
[花穗] 특정 그룹에 대해서 포인트 증감을 2번 하려 합니다.  
김현도970 글쓰기 관리자 메일전송 완료지연  
flyhighnino 레이아웃이 psd 파일인 경우에 적용시키는 방법? [1] 2009.03.20 by 알미
해커다 메뉴 출력 스킨 질문 file  
체이스 로그인폼은 포토샵에서 어떻게 슬라이스 하는지요? file  
우정훈762 google에서 제 홈페이지가 제대로 검색되지 않습니다.  
석이- 아래처럼 환율그래프를 홈페이지에 넣을 수 없을까요? file  
코어링 레이아웃 관련해서 질문드립니다.  
티천 게시물에 링크걸기 어떻게 하나요. [3] file 2009.03.20 by dd
takethat 검색바를 두고싶은데 [1] 2009.03.20 by 도로
Kamina 관리자페이지에서 위젯메뉴가 사라졌습니다!! [1] 2009.03.20 by Kamina
KRB 메일이 안보내 지네요..  
매실茶 메뉴 편집이 안됩니다 [6] 2009.03.20 by 웹조리
곰두리 내용의 값을 입력해 주세요 [2] 2009.03.20 by 곰두리
큐브넷 현재 1.1.3 사용하는데.. wiki..  
KRblue011 이거 어케하나요.. [1] 2009.03.20 by 백성찬
위젯문제 1.2.0 패치이후 1.1.5 에서 스던 위젯이 전부 안먹히는거 같아요 [1] 2009.03.20 by 백성찬
나우2006 페이지 최근글 위젯이 이상해졌어요~ [3] file 2009.03.20 by 백성찬
노인수 일본어가 제로보드에 글쓰면 폰트 크기가 마음대로 변해져 버립니다. [2] file 2009.03.20 by 노인수
왜만지냐 확장변수 권한설정 문의요