구찬아 ~list에서 각 게시물 첨부파일을 불러오고 싶습니다. 정보
게시판 구찬아 ~list에서 각 게시물 첨부파일을 불러오고 싶습니다.관련링크
첨부파일
본문
list에서 각 게시물 첨부파일을 불러오고 싶습니다.
1 게시판에 첩부파일을 1~10개쯤 첩부하여 작성한다
- 여기서 첩부파일의 개수는 기본 게시판 관리 수정 페이지에가면 적용하는 부분이있다
2 게시판 리스트에 적당히 공간을 만든다 필자는 제목과 글쓴이 사이에 삽입
3 대부분이 그러지만 그누보드 기본 배포 lib/common.lib.php 안에서 찾아본다
-역시나
// 게시글에 첨부된 파일을 얻는다. (배열로 반환)
function get_file($bo_table, $wr_id)
{
global $g5, $qstr;
$file['count'] = 0;
$sql = " select * from {$g5['board_file_table']} where bo_table = '$bo_table' and wr_id = '$wr_id' order by bf_no ";
$result = sql_query($sql);
while ($row = sql_fetch_array($result))
{
$no = $row['bf_no'];
$file[$no]['href'] = G5_BBS_URL."/download.php?bo_table=$bo_table&wr_id=$wr_id&no=$no" . $qstr;
$file[$no]['download'] = $row['bf_download'];
// 4.00.11 - 파일 path 추가
$file[$no]['path'] = G5_DATA_URL.'/file/'.$bo_table;
$file[$no]['size'] = get_filesize($row['bf_filesize']);
$file[$no]['datetime'] = $row['bf_datetime'];
$file[$no]['source'] = addslashes($row['bf_source']);
$file[$no]['bf_content'] = $row['bf_content'];
$file[$no]['content'] = get_text($row['bf_content']);
//$file[$no]['view'] = view_file_link($row['bf_file'], $file[$no]['content']);
$file[$no]['view'] = view_file_link($row['bf_file'], $row['bf_width'], $row['bf_height'], $file[$no]['content']);
$file[$no]['file'] = $row['bf_file'];
$file[$no]['image_width'] = $row['bf_width'] ? $row['bf_width'] : 640;
$file[$no]['image_height'] = $row['bf_height'] ? $row['bf_height'] : 480;
$file[$no]['image_type'] = $row['bf_type'];
$file['count']++;
}
return $file;
}
이러게 다 만들어 놓은걸 볼수있다
list.skin.pc.php 에서
<td class="list-img text-center">
<?
$dd_y= get_file($bo_table, $list[$i]['wr_id']);
// echo count($dd_y);
// echo $dd_y[0][href];
// $dd_array = explode(",", $dd_y);
for($i_dd=0;$i_dd<count($dd_y)-1;$i_dd++){
?>
<a href="<?=$dd_y[$i_dd][href]?>"><?=$dd_y[$i_dd][source]?></a>
<?}?>
</td>
이런식으로 추가를 하면 원하는 걸 할수있다
4
댓글 전체
질문내용
============================================================
<td>
<img src="<?=$board_skin_url?>/img/down00.gif" onmouseover="this.src='<?=$board_skin_url?>/img/down02.gif'" onmouseout="this.src='<?=$board_skin_url?>/img/down00.gif'" / width="52" height="22" alt="LISTEN" style="cursor:pointer;" onclick="javascript:alert('준비중에 있습니다.')" />
</td>
이런 코드가 있는데 이미지를 클릭하면 자동으로 게시물에 첨부파일을 불러오는 기능입니다.
이 코드를 어떻게 수정해야 불러올 수 있을까요? 도움 부탁 드립니다.
============================================================
와 감사합니다.. 해봤는데 2024년에도 작동하네요. 구조가 크게 변한 건 아닌가 봅니다
구조가 거의 그대로여요 코어가 많이 바뀌어지요