묻고답하기

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 남기남
권랑 4->xe 로 이전시에.. [1] 2011.03.02 by sozar
\"vusdo\" 문자 변수 구분이랑 /xe/./files/cache/opage/ 자동으로 생성되는 문제입니다.  
나의해 새글에 new 표시 깜빡거리게 하는 방법~ [1] 2011.03.01 by 나의해
나의해 새글에 new 표시 깜빡거리게 하는 방법~ [4] 2011.03.01 by 나의해
100억 지금 쉬운설치; 되나염? [1] 2011.03.01 by 백성찬
박노열 쉬운설치가 갑자기 안됩니다./ 도와주세요 [1] 2011.03.01 by 백성찬
바나나맛우유 쉬운설치 리스트가 안뜹니다 [6] 2011.03.01 by 신현국921
T1000 확장변수에서 일자 선택시 뜨는 달력 숫자로 나오게... [2] 2011.03.01 by T1000
1243312 갤러리 게시판 미리보기가 안됩니다. [3] 2011.03.01 by SeklutZ
뉴몬 회원가입시 서명 프로필사진 이미지이름출력...  
나뚜껑 이미지, 파일 업로드, 로그인 안됩니다. [1] 2011.03.01 by SeklutZ
규돌돌규 모바일 스킨에서 카테고리? 제작? 만들기? [1] 2011.03.01 by SeklutZ
뚜르자 이미지를 업로드할 수 있는 갤러리게시판 없나요? [1] 2011.03.01 by SeklutZ
CrowTM 질문좀 하겠습니다 [1] 2011.03.01 by SeklutZ
딸푸 오류가 뜨는데 뭔지 모르겠네요 ㅠ [1] 2011.03.01 by hhgyu
아아악내눈 텍스타일 생성할때 기본값으로 지정되는 스킨 변경하는 법 알고싶습니다. [1] 2011.03.01 by 아아악내눈
죽암 http://도메인.zetyx.net/ 이 잘않되요 [1] 2011.03.01 by 백성찬
죽암 좀 도와주세요 [1] 2011.03.01 by CrowTM
어쿠스틱 member_info.html에 한글을 넣으면 깨지는 이유? [1] 2011.03.01 by 어쿠스틱
벼리364 쉬운설치가 않되요....ㅡㅡ;; [3] 2011.03.01 by sooyouth
good499 도와주세요 인덱스페이지 에러입니다 ㅠㅠ [1] 2011.03.01 by ToFinder
asklee file not found 나옵니다. [1] 2011.03.01 by ToFinder
필름초보 외부게시판 불러오기 [2] 2011.03.01 by sooyouth
뿐뿐이 설치 완료후 다시 로그인을 할려면 [1] 2011.03.01 by 백성찬
아주가끔은 쉬운설치를 누르면 백지 상태가 되네요. [1] 2011.03.01 by 백성찬
백용권 제발도와주세요 - 제로보드 카페 설치했다 전부 다 에러나요 [1] 2011.03.01 by 백성찬
T1000 모바일스킨에선 수정이 안되나요? [1] 2011.03.01 by 백성찬
죽암 http://도메인.zetyx.net/ 이 잘않되요 [1] 2011.03.01 by 백성찬
yujin. 2차 메뉴 구성시 1차메뉴 벌어짐 과 2차 메뉴를 3차 메뉴로 [1] 2011.03.01 by ForHanbi
조준희ㅁㄴ 첨부파일 꼭 해야되나요? [1] 2011.03.01 by ForHanbi