Sketchbook5 게시판스킨에서 업로드 파일 목록을 XETown 자료실과 비슷한 형태로 꾸며보는 방법입니다.
1. skin.xml 파일에 추가 - 첨부파일 그룹밑에 두면 좋겠죠
<title xml:lang="ko">★자료실 형태</title>
<description xml:lang="ko">자료실 형태의 파일의 출력 여부를 선택합니다.</description>
<options value="">
<title xml:lang="ko">출력 안함(기본)</title>
</options>
<options value="Y">
<title xml:lang="ko">출력</title>
</options>
</var>
2. _read_data.html 파일을 하나 만들어 아래와 같이 코드를 적용합니다 - 다운 받으셔도 됩니다
<style>
.bd_tb .tc { text-align:center }
.bd_tb .tb { background-color:#f9f9f9 }
</style>
<div id="files_{$oDocument->document_srl}" class="rd_fnt rd_file">
<table class="et_vars bd_tb cont">
<thead>
<tr cond="$oDocument->hasUploadedFiles()" class="tb">
<th>파일명</th>
<th cond="!Mobile::isMobileCheckByAgent()" class="tc"> 업로드 일자 </th>
<th cond="!Mobile::isMobileCheckByAgent()" class="tc"> 파일 크기 </th>
<th class="tc"> 다운 수 </th>
</tr>
</thead>
<tbody>
{@ $re_files = array_reverse($oDocument->getUploadedFiles()) // 파일 역순으로 정렬 }
<tr loop="$re_files=>$key,$file">
{@
$ext = substr($file->source_filename, -4);
$ext = strtolower($ext);
$ext_img = in_array($ext,array('.jpg','jpeg','.gif','.png'));
$ext_video = in_array($ext,array('.mpg','mpeg','.avi','.wmv','.mp4','.mov','.mkv','.swf','.flv','.ogv','webm'));
$ext_audio = in_array($ext,array('.mp3','.ogg','.wma','.wav','.ape','flac','.mid'));
}
<block cond="!$ext_img && !$ext_video && !$ext_audio">
<td><a href="{getUrl('')}{$file->download_url}">{$file->source_filename}</a></td>
<td cond="!Mobile::isMobileCheckByAgent()" class="tc">{zdate($file->regdate, 'Y.m.d')}</td>
<td cond="!Mobile::isMobileCheckByAgent()" class="tc">{FileHandler::filesize($file->file_size)}</td>
<td class="tc">{number_format($file->download_count)}</td>
</block>
</tr>
</tbody>
</table>
</div>
•업로드 파일 역순으로 정렬은 기진곰님의 팁으로 완성했습니다 - 빨간색 https://xetown.com/questions/1753244
•이미지, 오디오, 동영상 파일을 제외한 파일만 출력됩니다 - 파란색
3. _read.html 파일안에 적당한 위치에 빨간색 코드를 삽입 - 저는 확장변수 출력칸 바로 위에 위치했습니다.
<!--// Body -->
<div class="rd_body clear">
<!--// 자료실형태 -->
<include cond="$oDocument->hasUploadedFiles() && $mi->data_files=='Y'" target="_read_data.html" />
<!--// Extra Var -->
4. "첨부파일 표시 방법"
"숨기고 버턴 표시(기본)" 선택하면 자료실 형태만 출력되고(버턴 클릭시 하단에 파일목록 출력되지 않음)
"표시 안함" 이외에 선택하면 해당 방법대로 출력됩니다.(확장자 필터 기능도 적용됨)
완성된 모습 https://moonhouse.co.kr/xemy/539975