(로또팁)첨부화일 갯수만큼 입력폼 뿌려주기 > 그누4 팁자료실

그누4 팁자료실

그누보드4와 관련된 팁을 여러분들과 함께 공유하세요.
나누면 즐거움이 커집니다.

(로또팁)첨부화일 갯수만큼 입력폼 뿌려주기 정보

(로또팁)첨부화일 갯수만큼 입력폼 뿌려주기

본문

해당 write.skin.php을 바꾸어 줍니다..
 
 
수정전 :
 
<? if ($is_file) { ?>
<tr>
    <td style='padding-left:20px; height:30px;'><table cellpadding=0 cellspacing=0><tr><td style=" padding-top: 10px;">· 파일 <span onclick="add_file();" style='cursor:pointer; font-family:tahoma; font-size:12pt;'>+</span> <span onclick="del_file();" style='cursor:pointer; font-family:tahoma; font-size:12pt;'>-</span></td></tr></table></td>
    <td style='padding:5 0 5 0;'><table id="variableFiles" cellpadding=0 cellspacing=0></table><?// print_r2($file); ?>
        <script language="JavaScript">
        var flen = 0;
        function add_file(delete_code)
        {
            var upload_count = <?=(int)$board[bo_upload_count]?>;
            if (upload_count && flen >= upload_count)
            {
                alert("이 게시판은 "+upload_count+"개 까지만 파일 업로드가 가능합니다.");
                return;
            }
            var objTbl;
            var objRow;
            var objCell;
            if (document.getElementById)
                objTbl = document.getElementById("variableFiles");
            else
                objTbl = document.all["variableFiles"];
            objRow = objTbl.insertRow(objTbl.rows.length);
            objCell = objRow.insertCell(0);
            objCell.innerHTML = "<input type='file' class='field_pub_01' name='bf_file[]' title='파일 용량 <?=$upload_max_filesize?> 이하만 업로드 가능'>";
            if (delete_code)
                objCell.innerHTML += delete_code;
            else
            {
                <? if ($is_file_content) { ?>
                objCell.innerHTML += "<br><input type='text' class='field_pub_01' size=50 name='bf_content[]' title='업로드 이미지 파일에 해당 되는 내용을 입력하세요.'>";
                <? } ?>
                ;
            }
            flen++;
        }
        <?=$file_script; //수정시에 필요한 스크립트?>
        function del_file()
        {
            // file_length 이하로는 필드가 삭제되지 않아야 합니다.
            var file_length = <?=(int)$file_length?>;
            var objTbl = document.getElementById("variableFiles");
            if (objTbl.rows.length - 1 > file_length)
            {
                objTbl.deleteRow(objTbl.rows.length - 1);
                flen--;
            }
        }
        </script></td>
</tr>
<tr><td colspan=2 height=1 bgcolor=#e7e7e7></td></tr>
<? } ?>
 
 
 
 
수정후 :
 
 
<? if ($is_file) { ?>
<tr>
    <td style='padding-left:20px; height:30px;'><table cellpadding=0 cellspacing=0><tr><td style=" padding-top: 10px;">· 파일 <span onclick="add_file();" style='cursor:pointer; font-family:tahoma; font-size:12pt;'>+</span> <span onclick="del_file();" style='cursor:pointer; font-family:tahoma; font-size:12pt;'>-</span></td></tr></table></td>
    <td style='padding:5 0 5 0;'><table id="variableFiles" cellpadding=0 cellspacing=0></table><?// print_r2($file); ?>
        <script language="JavaScript">
        var flen = 0;
        function add_file(delete_code)
        {
            var upload_count = <?=(int)$board[bo_upload_count]?>;
            if (upload_count && flen >= upload_count)
            {
                alert("이 게시판은 "+upload_count+"개 까지만 파일 업로드가 가능합니다.");
                return;
            }
            var objTbl;
            var objRow;
            var objCell;
            if (document.getElementById)
                objTbl = document.getElementById("variableFiles");
            else
                objTbl = document.all["variableFiles"];
            objRow = objTbl.insertRow(objTbl.rows.length);
            objCell = objRow.insertCell(0);
            objCell.innerHTML = "<input type='file' class='field_pub_01' name='bf_file[]' title='파일 용량 <?=$upload_max_filesize?> 이하만 업로드 가능'>";
            if (delete_code)
                objCell.innerHTML += delete_code;
            else
            {
                <? if ($is_file_content) { ?>
                objCell.innerHTML += "<br><input type='text' class='field_pub_01' size=50 name='bf_content[]' title='업로드 이미지 파일에 해당 되는 내용을 입력하세요.'>";
                <? } ?>
                ;
            }
            flen++;
        }
        <?=$file_script; //수정시에 필요한 스크립트?>
        function del_file()
        {
            // file_length 이하로는 필드가 삭제되지 않아야 합니다.
            var file_length = <?=(int)$file_length?>;
            var objTbl = document.getElementById("variableFiles");
            if (objTbl.rows.length - 1 > file_length)
            {
                objTbl.deleteRow(objTbl.rows.length - 1);
                flen--;
            }
        }
       
        <? if($w=="") {
          for($j=1; $j < $board[bo_upload_count]; $j++){ ?>
          add_file();
          <?  }
          } ?>
        </script></td>
</tr>
<tr><td colspan=2 height=1 bgcolor=#e7e7e7></td></tr>
<? } ?>
 
 
 
 
추가된 부분은
 
<? if($w=="") {
          for($j=1; $j < $board[bo_upload_count]; $j++){ ?>
          add_file();
          <?  }
          } ?>
 
로 필요시 $board[bo_upload_count];  를 숫자로 표현 하셔도 됩니다....
 
예) 폼은 2개만 보이고 업로드 수는 5라도 위에
 
$board[bo_upload_count]; 를 2로 바꾸어 두면 폼은 2개만 보이고 추가 버튼으로 추가가 가능합니다....
 
태클은 절대 사절......
 
 
 
추천은 필수~~~~~~^^
 
 
 
 
 
 
 
 
 
 
 
 
 
 
퍼가실때는 필히 출처를 밝혀 주십시오.
추천
1

댓글 8개

로또팁이라는건 즉 어떻게 쓰느냐에 따라 기본에서 더 얻느냐, 그냥 기본으로 가게되나 둘중 하나라는 팁이라는 거군요
<? if($w=="") { for($j=1; $j < $board[bo_upload_count]; $j++){ ?>
add_file();
<?  } } ?>
       
<? if($w=="u") { for($j=$file[count]; $j < $board[bo_upload_count]; $j++){ ?>
add_file();
<?  } } ?>
전체 9 |RSS
그누4 팁자료실 내용 검색

회원로그인

(주)에스아이알소프트 / 대표:홍석명 / (06211) 서울특별시 강남구 역삼동 707-34 한신인터밸리24 서관 1402호 / E-Mail: admin@sir.kr
사업자등록번호: 217-81-36347 / 통신판매업신고번호:2014-서울강남-02098호 / 개인정보보호책임자:김민섭(minsup@sir.kr)
© SIRSOFT