테스트 사이트 - 개발 중인 베타 버전입니다

그누보드 리스트화면에서 다운로드하기 팁 수정본..

· 12년 전 · 5482 · 5
스킨수정작업하다 세션관련 삽입해야 되는 부분 까먹어서 검색해본 팁을 가지고
제 나름대로 조금 쓰기 편하게 더 수정해봤습니다.

기록보존용 비스무리하게 남겨봅니다.

[code]
<pre class="brush: php"><script type="text/javascript">
// 파일다운로드를 위해 사용되는 js함수. php 구문 바깥에 넣어두세요.
function file_download(link, file) {
document.location.href=link;
}
</script>
<?
for ($i=0; $i<count($list); $i++) {
// for 반복구문 아래에다 집어넣습니다.

$ss_name = "ss_view_{$bo_table}_{$list[$i][wr_id]}";
session_register($ss_name);
$$ss_name = $HTTP_SESSION_VARS[$ss_name] = TRUE;
$files_path = $g4['path']."/data/file/".$bo_table."/";

for($j=0; $j<=count($list[$i][file]); $j++) {
if($list[$i][file][$j][file] && file_exists($files_path.$list[$i][file][$j][file])) {
$files_link[$j] = "<a href=\"javascript:file_download('{$list[$i][file][$j][href]}', '{$list[$i][file][$j][source]}');\" title=\"{$list[$i][file][$j][content]}\"--><p><img src="\&quot;{$board_skin_path}/img/icon_file.gif\&quot;" align="\&quot;absmiddle\&quot;" border="\&quot;0\&quot;">";
} else
$files_link[$j] = "파일없음"; // 또는 공백처리 하시던지
}
</p></pre>
[/code]

// 필요로 하는 곳에서
echo $files_link[0];
echo $files_link[1];
// 이런식으로 불러쓰시면 됩니다. 한 게시물당 파일이 다수이면 반복문으로 불러쓰셔도 됩니다.

검색해서 봤던 팁은 이겁니다. ↓↓
http://sir.co.kr/bbs/board.php?bo_table=g4_tiptech&wr_id=711

댓글 작성

댓글을 작성하시려면 로그인이 필요합니다.

로그인하기

댓글 5개

12년 전
좋은 정보 감사합니다...스크랩해두고 추후 적용해 봐야겠네요...
+_+ 감사합니다.
good!!!
^^;; 민망하네요
10년 전
감사합니다

게시글 목록

번호 제목
31942
31928
31927
31925
31863
31854
31853
31842
31827
31815
31811
31809
31805
31794
31785
31782
31756
31739
31735
31726