write.skin.php 파일의
파일설명 부분을 textarea로 고친다고 해결되는게 아니더라구요..
홈페이지 특성상 사진 한개당 설명이 몇십줄 정도 필요한 스킨을 제작해야하는데
도무지 방법이 없네요..
textarea로 변경시 write, view 는 제대로 동작은 하는데
수정시 자바스크립트 오류가 나더라구요..
고수님들 부탁드립니다!
파일설명 부분을 input-text가 아닌 textarea 로 표현하는 방법좀 가르쳐주세요~!
댓글을 작성하시려면 로그인이 필요합니다.
댓글 3개
/*---------------------------------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;" class=small>· 파일 <span onclick="add_file();" style='cursor:pointer;'>+</span> <span onclick="del_file();" style='cursor:pointer;'>-</span>
</td></tr>
</table></td>
<td style='padding:5 0 5 0;'>
<?
if ($w == "u")
{
$sql = "select bf_file, bf_content from $g4[board_file_table] where bo_table = '$bo_table' and wr_id = '$wr_id' ";
$result = sql_query($sql);
for($i=0; $row=sql_fetch_array($result); $i++){
if ($row[bf_file])
{
$file_script .= "<table border=0 width=100% cellpadding=0 cellspacing=0><tr><td colspan=2 class=small><input type='file' class=guide_444444 size=40 name='bf_file[$i]' title='파일 용량 $upload_max_filesize 이하만 업로드 가능'> <img src='$g4[path]/img00/buy_arr.gif' border=0 align=absmiddle>파일설명을 적어주세요.";
$file_script .= "<input type='checkbox' name='bf_file_del[$i]' value='1'><a href='{$file[$i][href]}'>{$file[$i][source]}({$file[$i][size]})</a> 파일 삭제</td></tr>";
if ($is_file_content)
$bf_id = "bf_content_{$i}";
//
//<input type=text id='bf_content_{$i} name='bf_content[$i]' value='".addslashes(get_text($row[bf_content]))."'>
$file_script .= "<tr><td width='98%'><textarea id='bf_content_{$i}' name='bf_content[$i]' style='width:100%; word-break:break-all;' rows=3 itemname='내용' required>".addslashes(get_text($row[bf_content]))."</textarea></td><td width=2% valign=top><a href=javascript:textarea_decrease('bf_content_{$i}',3);><img src='$board_skin_path/img/up.gif' border=0><br><a href=javascript:textarea_original('bf_content_{$i}',3);><img src='$board_skin_path/img/start.gif' border=0><br><a href=javascript:textarea_increase('bf_content_{$i}',3);><img src='$board_skin_path/img/down.gif' border=0></a></td></tr>";
$file_script .= "</table>";
}
}
$file_length = $file[count] - 1;
echo $file_script;
}
if ($file_length < 0)
{
$run_script .= "add_file('');\n";
$file_length = 0;
}
?>
<table id="variableFiles" cellpadding=0 cellspacing=0 width=100%></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 temp_html="";
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);
temp_html = "<table border=0 width=100% cellpadding=0 cellspacing=0><tr><td colspan=2 class=small><input type='file' class=guide_444444 size=40 name='bf_file[]' title='파일 용량 <?=$upload_max_filesize?> 이하만 업로드 가능'> <img src='<?=$g4[path]?>/img00/buy_arr.gif' border=0 align=absmiddle>파일설명을 적어주세요.";
if (delete_code)
temp_html += delete_code;
else
{
temp_html += "</td></tr>";
<? if ($is_file_content) { ?>
temp_html += "<tr><td width='100%'><textarea id='bf_content_"+flen+"' name='bf_content[]' style='width:98%; word-break:break-all;' rows=3 itemname='내용' required></textarea></td><td width=15 nowrap valign=top style='padding:2 2 2 2;'><img src='<?=$board_skin_path?>/img/up.gif' onclick=\"textarea_decrease('bf_content_"+flen+"', 3);\" style='cursor:hand;'><BR><img src='<?=$g4[path]?>/img00/space.gif' border=0><img src='<?=$board_skin_path?>/img/start.gif' onclick=\"textarea_original('bf_content_"+flen+"', 3);\" style='cursor:hand;'><BR><img src='<?=$g4[path]?>/img00/space.gif' border=0><img src='<?=$board_skin_path?>/img/down.gif' onclick=\"textarea_increase('bf_content_"+flen+"', 3);\" style='cursor:hand;'></td></tr>";
<? } ?>
;
}
objCell.innerHTML = temp_html+"</table><img src='<?=$g4[path]?>/img00/space.gif' border=0 height=5>";
flen++;
}
<?=$run_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>
<? } ?>
/*------------------------------------------write.update.skin.php ------------------------------*/
// 자신만의 코드를 넣어주세요.
$data_path = $g4[path]."/data/file/$bo_table";
$thumb_path = $data_path.'/thumb';
if($w=="u"){
for ($i=0; $i<count($_FILES[bf_file][name]); $i++)
{
// 삭제에 체크가 되어있다면 파일을 삭제합니다.
if ($_POST[bf_file_del][$i])
{
$upload[$i][del_check] = true;
$row = sql_fetch(" select bf_no, bf_file from $g4[board_file_table] where bo_table = '$bo_table' and wr_id = '$wr_id' and bf_no = '$i' ");
$image = urlencode($row[bf_file]);
$thumbimg="$thumb_path/thumb_view_" . $image."_view" ;
$list_thumb = "$thumb_path/$wr_id" ;
@unlink("$thumbimg");
@unlink("$list_thumb");
}
}
for ($i=0; $i<count($upload); $i++)
{
$row = sql_fetch(" select count(*) as cnt from $g4[board_file_table] where bo_table = '$bo_table' and wr_id = '$wr_id' and bf_no = '$i' ");
if ($row[cnt])
{
// 삭제에 체크가 있거나 파일이 있다면 업데이트를 합니다.
// 그렇지 않다면 내용만 업데이트 합니다.
$bf_content[$i] = stripslashes($bf_content[$i]);
if ($upload[$i][del_check] || $upload[$i][file])
{
$sql = " update $g4[board_file_table]
set bf_content = '{$bf_content[$i]}'
where bo_table = '$bo_table'
and wr_id = '$wr_id'
and bf_no = '$i' ";
sql_query($sql);
}
else
{
$sql = " update $g4[board_file_table]
set bf_content = '{$bf_content[$i]}'
where bo_table = '$bo_table'
and wr_id = '$wr_id'
and bf_no = '$i' ";
sql_query($sql);
}
}
}
}
이 버그는 파일설명부분에 ' 혹은 " 이 들어있을경우 그랬는데요.. 약간만 수정이 되있습니다.. 그래도 동작은 잘해요 ㅎㅎ;;
수정이 되지 않을때는 거의 처음올린 게시물일 경우가 제일 많더군요;;
그리고~ 텍스트 에어리어 늘리고 줄이고 하는거까지 붙여서 사용햇으니.. 쓰시는데는 불편없으리라 생각됩니다.
파일 자체가 필요하시면 쪽지주셔요
write.skin.php 파일에 109~165라인을 삭제하신후 붙여넣기 하시면되구요
write.update.skin.php 파일은 그냥 붙여넣기 하시면됩다..