리스트 첨부파일 아이콘만 보이고 싶어요
본문
안녕하세요.
게시판 리스트에 첨부파일 아이콘만 보이고 싶은데 어떻게 해야할지 모르겠네요.
도움 부탁드립니다.
어디를 수정해야 하는 걸까요?
3번째 쓰네요 ㅎㅎ;;
<!-- 게시판 페이지 정보 및 버튼 시작 { -->
<div class="bo_fx">
<div id="bo_list_total">
<span>Total <?php echo number_format($total_count) ?>건</span>
<?php echo $page ?> 페이지
</div>
<?php if ($rss_href || $write_href) { ?>
<ul class="btn_bo_user">
<?php if ($rss_href) { ?><li><a href="<?php echo $rss_href ?>" class="btn_b01">RSS</a></li><?php } ?>
<?php if ($admin_href) { ?><li><a href="<?php echo $admin_href ?>" class="btn_admin">관리자</a></li><?php } ?>
<?php if ($write_href) { ?><li><a href="<?php echo $write_href ?>" class="btn_b02">글쓰기</a></li><?php } ?>
</ul>
<?php } ?>
</div>
<!-- } 게시판 페이지 정보 및 버튼 끝 -->
<form name="fboardlist" id="fboardlist" action="./board_list_update.php" onsubmit="return fboardlist_submit(this);" method="post">
<input type="hidden" name="bo_table" value="<?php echo $bo_table ?>">
<input type="hidden" name="sfl" value="<?php echo $sfl ?>">
<input type="hidden" name="stx" value="<?php echo $stx ?>">
<input type="hidden" name="spt" value="<?php echo $spt ?>">
<input type="hidden" name="sca" value="<?php echo $sca ?>">
<input type="hidden" name="page" value="<?php echo $page ?>">
<input type="hidden" name="sw" value="">
<div class="tbl_head01 tbl_wrap">
<span class="td_chk"><?php echo $list[$i]['subject'] ?></span>
<table>
<caption><?php echo $board['bo_subject'] ?> 목록</caption>
<thead>
<tr >
<?php if ($is_checkbox) { ?>
<th width="20" style="background:white;" scope="col">
<label for="chkall" class="sound_only">현재 페이지 게시물 전체</label>
<input type="checkbox" id="chkall" onclick="if (this.checked) all_checked(true); else all_checked(false);">
</th>
<?php } ?>
<th width="34" style="background:white;" scope="col"><p>Item#</p></th>
<th width="104" style="background:white;" scope="col"><p>Wavelength</p>
<p>(nm)</p></th>
<th width="122" style="background:white;" scope="col"><p>Dimensions</p>
<p>(mm)</p></th>
<th width="77" style="background:white;" scope="col">Output Power(mW)</th>
<th width="86" style="background:white;" scope="col"><p>Input Voltage</p>
<p>(V DC)</p></th>
<th width="79" style="background:white;" scope="col"><p>Current</p>
<p>(mA)</p></th>
<th width="72" style="background:white;" scope="col"><p>Beam Mode</p></th>
<th width="64" style="background:white;" scope="col">Download</th>
<?php if ($is_good) { ?><?php } ?>
<?php if ($is_nogood) { ?><?php } ?>
</tr>
</thead>
<tbody>
<?php
for ($i=0; $i<count($list); $i++) {
$file = get_file($bo_table, $list[$i]['wr_id']);
$ss_name = "ss_view_{$bo_table}_{$list[$i][wr_id]}";
session_register($ss_name);
$$ss_name = $HTTP_SESSION_VARS[$ss_name] = TRUE;
?>
<tr class="<?php if ($list[$i]['is_notice']) echo "bo_notice"; ?>">
<?php if ($is_checkbox) { ?>
<td class="td_chk"><input type="checkbox" name="chk_wr_id[]" value="<?php echo $list[$i]['wr_id'] ?>" id="chk_wr_id_<?php echo $i ?>">
</td>
<?php } ?>
<td class="td_board">
<a href="./write.php?w=u&bo_table=<?=$bo_table?>&wr_id=<?=$list[$i][wr_id]?>"> <?php echo $list[$i]['subject'] ?></a>
<?php
// if ($list[$i]['link']['count']) { echo '['.$list[$i]['link']['count']}.']'; }
// if ($list[$i]['file']['count']) { echo '<'.$list[$i]['file']['count'].'>'; }
if (isset($list[$i]['icon_new'])) echo $list[$i]['icon_new'];
if (isset($list[$i]['icon_hot'])) echo $list[$i]['icon_hot'];
if (isset($list[$i]['icon_secret'])) echo $list[$i]['icon_secret'];
?>
</td>
<td class="td_num"><?php echo $list[$i]['wr_1'] ?></td>
<td class="td_num"><?php echo $list[$i]['wr_7'] ?></td>
<td class="td_num"><?php echo $list[$i]['wr_2'] ?></td>
<td class="td_num"><?php echo $list[$i]['wr_3'] ?></td>
<td class="td_num"><?php echo $list[$i]['wr_4'] ?></td>
<td class="td_num"><?php echo $list[$i]['wr_5'] ?></td>
<td>
<table>
<?
for ($j=0; $j<count($file)-1; $j++) {
echo "<tr ><td style='border-bottom:0px solid #ddd;border-top:0px solid #ff6600;padding:3px 3px;'>";
if( $list[$i]['wr_6'] <= $member['mb_level']) echo "<a href=\"{$file[$j][href]}\">";
echo $file[$j][source];
if( $list[$i]['wr_6'] >= $member['mb_level'] ) echo "</a>";
echo "</td></tr>";
}
?>
</table>
</td>
<?php if ($is_good) { ?><?php } ?>
<?php if ($is_nogood) { ?><?php } ?>
</tr>
<?php } ?>
<?php if (count($list) == 0) { echo '<tr><td colspan="'.$colspan.'" class="empty_table">게시물이 없습니다.</td></tr>'; } ?>
</tbody>
</table>
</div>
<?php if ($list_href || $is_checkbox || $write_href) { ?>
<div class="bo_fx">
<?php if ($is_checkbox) { ?>
<ul class="btn_bo_adm">
<li><input type="submit" name="btn_submit" value="선택삭제" onclick="document.pressed=this.value"></li>
<li><input type="submit" name="btn_submit" value="선택복사" onclick="document.pressed=this.value"></li>
<li><input type="submit" name="btn_submit" value="선택이동" onclick="document.pressed=this.value"></li>
</ul>
<?php } ?>
<?php if ($list_href || $write_href) { ?>
<ul class="btn_bo_user">
<?php if ($list_href) { ?><li><a href="<?php echo $list_href ?>" class="btn_b01">목록</a></li><?php } ?>
<?php if ($write_href) { ?><li><a href="<?php echo $write_href ?>" class="btn_b02">글쓰기</a></li><?php } ?>
</ul>
<?php } ?>
</div>
<?php } ?>
</form>
</div>
<?php if($is_checkbox) { ?>
<noscript>
<p>자바스크립트를 사용하지 않는 경우<br>별도의 확인 절차 없이 바로 선택삭제 처리하므로 주의하시기 바랍니다.</p>
</noscript>
<?php } ?>
<!-- 페이지 -->
답변 2
echo $file[$j][source]; 를 아래처럼 해보세요!
$file = explode(".", $file[$j][source]);
echo $file[1];
위처럼 했을때 pdf 라는 이미지 확장자만 나온다면... 아래처럼 추가하시면 될듯 합니다.
if ($file[1] == "pdf) echo "<img src='image/pdf.png'>";
if ($file[1] == "psd") echo "<img src='image/psd.png'>";