스케치북 게시판 스킨에서 첨부파일 '확장자 필터'를 활성화시켜서 첨부파일 목록에 이미지, 동영상, 음악 파일 등이 나타나지 않게 하고 있습니다. 잘 적용됩니다.
그런데 아래 이미지에서처럼 첨부파일 갯수는 필터링된 파일까지 포함해서 계산되더라구요. 첨부 '3'. 제가 원하는대로라면 (파일 목록에 표시된 수만큼) 첨부 '1'로 나와야 하는데 말이죠.

이 부분 소스가 _read_files.html 파일에서 5번째 줄에 해당하는데요. 어떻게 고쳐야 전체 첨부파일 갯수에서 필터링한 파일 갯수를 뺀 만큼만 나올 수가 있을까요?
<div id="files_{$oDocument->document_srl}" class="rd_fnt rd_file<!--@if(!$mi->show_files)--> hide_file<!--@end-->">
<table class="bd_tb">
<caption class="blind">Atachment</caption>
<tr>
<th scope="row" class="ui_font"><strong>{$lang->uploaded_file}</strong> <span class="fnt_count">'<b>{$oDocument->get('uploaded_count')}</b>'</span></th>
<td>
<ul cond="!$mi->files_type">
<li loop="$oDocument->getUploadedFiles()=>$key,$file"><a class="bubble" href="{getUrl('')}{$file->download_url}" title="[File Size:{FileHandler::filesize($file->file_size)}/Download:{number_format($file->download_count)}]">{$file->source_filename}</a><span class="comma">,</span></li>
</ul>
<ul cond="$mi->files_type">
<block loop="$oDocument->getUploadedFiles()=>$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'));
}
<li cond="!$mi->files_img && $ext_img"><a class="bubble" href="{getUrl('')}{$file->download_url}" title="[File Size:{FileHandler::filesize($file->file_size)}/Download:{number_format($file->download_count)}]">{$file->source_filename}</a><span class="comma">,</span></li>
<li cond="!$mi->files_video && $ext_video"><a class="bubble" href="{getUrl('')}{$file->download_url}" title="[File Size:{FileHandler::filesize($file->file_size)}/Download:{number_format($file->download_count)}]">{$file->source_filename}</a><span class="comma">,</span></li>
<li cond="!$mi->files_audio && $ext_audio"><a class="bubble" href="{getUrl('')}{$file->download_url}" title="[File Size:{FileHandler::filesize($file->file_size)}/Download:{number_format($file->download_count)}]">{$file->source_filename}</a><span class="comma">,</span></li>
<li cond="!$mi->files_etc && (!$ext_img && !$ext_video && !$ext_audio)"><a class="bubble" href="{getUrl('')}{$file->download_url}" title="[File Size:{FileHandler::filesize($file->file_size)}/Download:{number_format($file->download_count)}]">{$file->source_filename}</a><span class="comma">,</span></li>
</block>
</ul>
</td>
</tr>
</table>
</div>
<table class="bd_tb">
<caption class="blind">Atachment</caption>
<tr>
<th scope="row" class="ui_font"><strong>{$lang->uploaded_file}</strong> <span class="fnt_count">'<b>{$oDocument->get('uploaded_count')}</b>'</span></th>
<td>
<ul cond="!$mi->files_type">
<li loop="$oDocument->getUploadedFiles()=>$key,$file"><a class="bubble" href="{getUrl('')}{$file->download_url}" title="[File Size:{FileHandler::filesize($file->file_size)}/Download:{number_format($file->download_count)}]">{$file->source_filename}</a><span class="comma">,</span></li>
</ul>
<ul cond="$mi->files_type">
<block loop="$oDocument->getUploadedFiles()=>$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'));
}
<li cond="!$mi->files_img && $ext_img"><a class="bubble" href="{getUrl('')}{$file->download_url}" title="[File Size:{FileHandler::filesize($file->file_size)}/Download:{number_format($file->download_count)}]">{$file->source_filename}</a><span class="comma">,</span></li>
<li cond="!$mi->files_video && $ext_video"><a class="bubble" href="{getUrl('')}{$file->download_url}" title="[File Size:{FileHandler::filesize($file->file_size)}/Download:{number_format($file->download_count)}]">{$file->source_filename}</a><span class="comma">,</span></li>
<li cond="!$mi->files_audio && $ext_audio"><a class="bubble" href="{getUrl('')}{$file->download_url}" title="[File Size:{FileHandler::filesize($file->file_size)}/Download:{number_format($file->download_count)}]">{$file->source_filename}</a><span class="comma">,</span></li>
<li cond="!$mi->files_etc && (!$ext_img && !$ext_video && !$ext_audio)"><a class="bubble" href="{getUrl('')}{$file->download_url}" title="[File Size:{FileHandler::filesize($file->file_size)}/Download:{number_format($file->download_count)}]">{$file->source_filename}</a><span class="comma">,</span></li>
</block>
</ul>
</td>
</tr>
</table>
</div>
윤삼
Lv. 19
아무래도 중급 초반 수준의 코딩 오타쿠인 것 같습니다.
댓글 2
어느정도 알고 계신다는 전제하에 말씀드립니다. 윤삼님 실력이라면 할수 있을거에요!
block loop에서 이미지파일 기타등등을 걸러낼때마다 임시 변수값을 1씩 증가시키는 겁니다.
{$oDocument->get('uploaded_count')} 가 첨부파일 갯수잖아요?
그러면 거기에서 임시 변수값만큼 빼시고 그 값을 {$oDocument->get('uploaded_count')} 대신에 출력하면 됩니다.
숫자 하나 때문에 부담만 늘어나는 거 같아서 결국 첨부파일 갯수 표시를 아예 삭제해버리기로 했어요. 별 거 아닌 일에 너무 집착하는 거 같기도 하구요ㅎㅎ
제 실력이란 게 이 정돕니다 하하핫-! ㅠㅠㅠ
댓글 감사합니다~