BLOG main image
분류 전체보기 (65)
JSP (6)
Android (1)
ASP.NET (0)
MSSQL (4)
PHP (18)
ASP (11)
오픈 API (1)
HTML (2)
JavaScript (0)
Windows Programming (8)
컴퓨터교양 (14)
객체 지향 (0)
리뷰 및 생각 (0)
Visitors up to today!
Today hit, Yesterday hit
daisy rss
tistory 티스토리 가입하기!
'PHP'에 해당되는 글 18건
2014. 1. 6. 06:20

관리자 > 환경설정 > 기본환경설정
에서 여분필드를 설정 할 수 있다.
왼쪽에는 필드명을 입력하고, 오른쪽에는 값을 입력한다.
image


설정한 정보는 아래 있는 기본환경설정 테이블에 저장된다.
필드명은 cf_1_subj, 값은 cf_1에 저장된다.
image

PHP에서 아래의 코드로 출력해 볼 수 있다.
<?=$config[cf_1_subj]?>
<?=$config[cf_1]?>

2013. 12. 27. 17:03

/bbs/write.php

//--------------------------------------------------------------------------
// 가변 파일
$file_script = "";
$file_length = -1;
// 수정의 경우 파일업로드 필드가 가변적으로 늘어나야 하고 삭제 표시도 해주어야 합니다.
if ($w == "u")
{
    for ($i=0; $i<$file[count]; $i++)
    {
        $row = sql_fetch(" select bf_file, bf_content from $g4[board_file_table] where bo_table = '$bo_table' and wr_id = '$wr_id' and bf_no = '$i' ");
        if ($row[bf_file])
        {
            $file_script .= "add_file(\"<input type='checkbox' name='bf_file_del[$i]' value='1'><a href='{$file[$i][href]}'>{$file[$i][source]}({$file[$i][size]})</a> 파일 삭제";

            if ($file[$i][image_type] != 0)
                $file_script .= "<br /><img src='{$file[$i][href]}' width='250' border='0' />";

            if ($is_file_content)
                //$file_script .= "<br><input type='text' class=ed size=50 name='bf_content[$i]' value='{$row[bf_content]}' title='업로드 이미지 파일에 해당 되는 내용을 입력하세요.'>";
                // 첨부파일설명에서 ' 또는 " 입력되면 오류나는 부분 수정
                $file_script .= "<br><input type='text' class=ed size=50 name='bf_content[$i]' value='".addslashes(get_text($row[bf_content]))."' title='업로드 이미지 파일에 해당 되는 내용을 입력하세요.'>";
            $file_script .= "\");\n";
        }
        else
            $file_script .= "add_file('');\n";
    }
    $file_length = $file[count] - 1;
}

2013. 12. 23. 17:40

/skin/board/basic/view_skin.php

<tr>
    <td height=30 background="<?=$board_skin_path?>/img/view_dot.gif" style="color:#888;">
        <div style="float:left;">
        &nbsp;글쓴이 :
        <?=$view[name]?><? if ($is_ip_view) { echo "&nbsp;($ip)"; } ?>
        </div>
        <div style="float:right;">
        <img src="<?=$board_skin_path?>/img/icon_view.gif" border='0' align=absmiddle> 조회 : <?=number_format($view[wr_hit])?>
        <? if ($is_good) { ?>&nbsp;<img src="<?=$board_skin_path?>/img/icon_good.gif" border='0' align=absmiddle> 추천 : <?=number_format($view[wr_good])?><? } ?>
        <? if ($is_nogood) { ?>&nbsp;<img src="<?=$board_skin_path?>/img/icon_nogood.gif" border='0' align=absmiddle> 비추천 : <?=number_format($view[wr_nogood])?><? } ?>
        &nbsp;
        </div>
    </td>
</tr>


<? if ($board[bo_1_subj] != "") { ?>
<tr>
    <td height=30 background="<?=$board_skin_path?>/img/view_dot.gif" style="color:#888;">
        <div style="float:left;">&nbsp;<?=$board[bo_1_subj]?> : <?=$view[wr_1]?></div>
    </td>
</tr>
<? } ?>


<? if ($board[bo_2_subj] != "") { ?>
<tr>
    <td height=30 background="<?=$board_skin_path?>/img/view_dot.gif" style="color:#888;">
        <div style="float:left;">&nbsp;<?=$board[bo_2_subj]?> : <?=$view[wr_2]?></div>
    </td>
</tr>
<? } ?>


<? if ($board[bo_3_subj] != "") { ?>
<tr>
    <td height=30 background="<?=$board_skin_path?>/img/view_dot.gif" style="color:#888;">
        <div style="float:left;">&nbsp;<?=$board[bo_3_subj]?> : <?=$view[wr_3]?></div>
    </td>
</tr>
<? } ?>


<? if ($board[bo_4_subj] != "") { ?>
<tr>
    <td height=30 background="<?=$board_skin_path?>/img/view_dot.gif" style="color:#888;">
        <div style="float:left;">&nbsp;<?=$board[bo_4_subj]?> : <?=$view[wr_4]?></div>
    </td>
</tr>
<? } ?>


<? if ($board[bo_5_subj] != "") { ?>
<tr>
    <td height=30 background="<?=$board_skin_path?>/img/view_dot.gif" style="color:#888;">
        <div style="float:left;">&nbsp;<?=$board[bo_5_subj]?> : <?=$view[wr_5]?></div>
    </td>
</tr>
<? } ?>


<? if ($board[bo_6_subj] != "") { ?>
<tr>
    <td height=30 background="<?=$board_skin_path?>/img/view_dot.gif" style="color:#888;">
        <div style="float:left;">&nbsp;<?=$board[bo_6_subj]?> : <?=$view[wr_6]?></div>
    </td>
</tr>
<? } ?>


<? if ($board[bo_7_subj] != "") { ?>
<tr>
    <td height=30 background="<?=$board_skin_path?>/img/view_dot.gif" style="color:#888;">
        <div style="float:left;">&nbsp;<?=$board[bo_7_subj]?> : <?=$view[wr_7]?></div>
    </td>
</tr>
<? } ?>


<? if ($board[bo_8_subj] != "") { ?>
<tr>
    <td height=30 background="<?=$board_skin_path?>/img/view_dot.gif" style="color:#888;">
        <div style="float:left;">&nbsp;<?=$board[bo_8_subj]?> : <?=$view[wr_8]?></div>
    </td>
</tr>
<? } ?>


<? if ($board[bo_9_subj] != "") { ?>
<tr>
    <td height=30 background="<?=$board_skin_path?>/img/view_dot.gif" style="color:#888;">
        <div style="float:left;">&nbsp;<?=$board[bo_9_subj]?> : <?=$view[wr_9]?></div>
    </td>
</tr>
<? } ?>


<? if ($board[bo_10_subj] != "") { ?>
<tr>
    <td height=30 background="<?=$board_skin_path?>/img/view_dot.gif" style="color:#888;">
        <div style="float:left;">&nbsp;<?=$board[bo_10_subj]?> : <?=$view[wr_10]?></div>
    </td>
</tr>
<? } ?>

2013. 12. 23. 17:39

아래 그림은 여분필드를 설정하는 부분입니다.(“게시판관리 > 특정 게시판 수정”)
왼쪽에 여분필드명을 넣고, 오른쪽에 설명을 넣습니다. 왼쪽이 중요합니다.
image

위에서 설정한 정보는 g4_board에 저장 됩니다.
image
어찌된 영문인지 게시판 설정정보를 이용하는 코딩이 안되있더군요.
여분필드를 설정했다고 해서, 아래 그림과 같이 여분필드명이 나오지는 않습니다.
여분필드명은 $board[bo_1_subj] 으로 출력할 수 있습니다.
image

여기까지는 게시판 설정정보이고, 실제 게시물은 각각의 게시판 테이블에 저장됩니다.
image
위 구조에서 보듯이 여분필드 내용은 wr_1에 저장해야 합니다.
<input name=”wr_1” />라고 해줘야 한다는 것 입니다.

그리고 그누보드는 글쓰기와 글수정을 모두 write_skin.php를 사용합니다.
글수정시 input 태그의 value에 wr_1에 저장된 내용을 적어줘야 합니다.
wr_1에 저장된 내용은 $write[wr_1] 으로 끄집어 낼 수 있습니다.


아래는 지금까지 설명한 내용을 토대로 write_skin.php를 확장한 코딩입니다.
굻은글씨가 추가된 부분입니다.
게시판 설정정보에 있는 여분필드명( $board[bo_1_subj]  )을 출력하고,
글쓰기시 실제 게시판 테이블에 있는 wr_1 필드에 저장 합니다.
글수정시 wr_1은 $write[wr_1] 으로 출력합니다.



/skin/board/basic/write_skin.php

<tr>
    <td class=write_head>제 목</td>
    <td><input class='ed' style="width:100%;" name=wr_subject id="wr_subject" itemname="제목" required value="<?=$subject?>"></td></tr>
<tr><td colspan=2 height=1 bgcolor=#e7e7e7></td></tr>

 

<? if ($board[bo_1_subj] != "") { ?>
<tr>    <td class=write_head><?=$board[bo_1_subj]?></td>
    <td><input class="ed" style="width:100%;" name="wr_1" id="wr_1" itemname="<?=$board[bo_1_subj]?>" value="<?=$write[wr_1]?>"></td>
</tr>
<tr><td colspan=2 height=1 bgcolor=#e7e7e7></td></tr>
<? } ?>

<? if ($board[bo_2_subj] != "") { ?>
<tr>
    <td class=write_head><?=$board[bo_2_subj]?></td>
    <td><input class="ed" style="width:100%;" name="wr_2" id="wr_2" itemname="<?=$board[bo_2_subj]?>" value="<?=$write[wr_2]?>"></td>
</tr>
<tr><td colspan=2 height=1 bgcolor=#e7e7e7></td></tr>
<? } ?>

<? if ($board[bo_3_subj] != "") { ?>
<tr>
    <td class=write_head><?=$board[bo_3_subj]?></td>
    <td><input class="ed" style="width:100%;" name="wr_3" id="wr_3" itemname="<?=$board[bo_3_subj]?>" value="<?=$write[wr_3]?>"></td>
</tr>
<tr><td colspan=2 height=1 bgcolor=#e7e7e7></td></tr>
<? } ?>

<? if ($board[bo_4_subj] != "") { ?>
<tr>
    <td class=write_head><?=$board[bo_4_subj]?></td>
    <td><input class="ed" style="width:100%;" name="wr_4" id="wr_4" itemname="<?=$board[bo_4_subj]?>" value="<?=$write[wr_4]?>"></td>
</tr>
<tr><td colspan=2 height=1 bgcolor=#e7e7e7></td></tr>
<? } ?>

<? if ($board[bo_5_subj] != "") { ?>
<tr>
    <td class=write_head><?=$board[bo_5_subj]?></td>
    <td><input class="ed" style="width:100%;" name="wr_5" id="wr_5" itemname="<?=$board[bo_5_subj]?>" value="<?=$write[wr_5]?>"></td>
</tr>
<tr><td colspan=2 height=1 bgcolor=#e7e7e7></td></tr>
<? } ?>

<? if ($board[bo_6_subj] != "") { ?>
<tr>
    <td class=write_head><?=$board[bo_6_subj]?></td>
    <td><input class="ed" style="width:100%;" name="wr_6" id="wr_6" itemname="<?=$board[bo_6_subj]?>" value="<?=$write[wr_6]?>"></td>
</tr>
<tr><td colspan=2 height=1 bgcolor=#e7e7e7></td></tr>
<? } ?>

<? if ($board[bo_7_subj] != "") { ?>
<tr>
    <td class=write_head><?=$board[bo_7_subj]?></td>
    <td><input class="ed" style="width:100%;" name="wr_7" id="wr_7" itemname="<?=$board[bo_7_subj]?>" value="<?=$write[wr_7]?>"></td>
</tr>
<tr><td colspan=2 height=1 bgcolor=#e7e7e7></td></tr>
<? } ?>

<? if ($board[bo_8_subj] != "") { ?>
<tr>
    <td class=write_head><?=$board[bo_8_subj]?></td>
    <td><input class="ed" style="width:100%;" name="wr_8" id="wr_8" itemname="<?=$board[bo_8_subj]?>" value="<?=$write[wr_8]?>"></td>
</tr>
<tr><td colspan=2 height=1 bgcolor=#e7e7e7></td></tr>
<? } ?>

<? if ($board[bo_9_subj] != "") { ?>
<tr>
    <td class=write_head><?=$board[bo_9_subj]?></td>
    <td><input class="ed" style="width:100%;" name="wr_9" id="wr_9" itemname="<?=$board[bo_9_subj]?>" value="<?=$write[wr_9]?>"></td>
</tr>
<tr><td colspan=2 height=1 bgcolor=#e7e7e7></td></tr>
<? } ?>

<? if ($board[bo_10_subj] != "") { ?>
<tr>
    <td class=write_head><?=$board[bo_10_subj]?></td>
    <td><input class="ed" style="width:100%;" name="wr_10" id="wr_10" itemname="<?=$board[bo_10_subj]?>" value="<?=$write[wr_10]?>"></td>
</tr>
<tr><td colspan=2 height=1 bgcolor=#e7e7e7></td></tr>
<? } ?>

2013. 12. 23. 17:37

/skin/board/basic/list_skin.php

<td class="subject">
       
       
            <?
            // 파일 출력
            /*
            for ($j=0; $j<=count($list[$i][file]); $j++) {
                if ($list[$i][file][$j][view])
                    echo $list[$i][file][$j][view] . "<p>";
            }
            */
            if ($list[$i][file][0][view])
                echo "<img src='$g4[path]/data/file/$bo_table/{$list[$i][file][0][file]}' align='absmiddle' width='100' height='60' />";
            ?>
       
            <?
            echo $nobr_begin;
            echo $list[$i][reply];
            echo $list[$i][icon_reply];
            if ($is_category && $list[$i][ca_name]) {
                echo "<span class=small><font color=gray>[<a href='{$list[$i][ca_name_href]}'>{$list[$i][ca_name]}</a>]</font></span> ";
            }

            if ($list[$i][is_notice])
                echo "<a href='{$list[$i][href]}'><span class='notice'>{$list[$i][subject]}</span></a>";
            else
                echo "<a href='{$list[$i][href]}'>{$list[$i][subject]}</a>";

            if ($list[$i][comment_cnt])
                echo " <a href=\"{$list[$i][comment_href]}\"><span class='comment'>{$list[$i][comment_cnt]}</span></a>";

            // if ($list[$i]['link']['count']) { echo "[{$list[$i]['link']['count']}]"; }
            // if ($list[$i]['file']['count']) { echo "<{$list[$i]['file']['count']}>"; }

            echo " " . $list[$i][icon_new];
            echo " " . $list[$i][icon_file];
            echo " " . $list[$i][icon_link];
            echo " " . $list[$i][icon_hot];
            echo " " . $list[$i][icon_secret];
            echo $nobr_end;
            ?>
        </td>

2013. 12. 20. 18:59


제로보드 다국어 기능
제로보드의 다국어 기능은 아래와 같이 셀렉트박스의 형태로 제공합니다.
image

사실 셀렉트 박스가 아니라 ul li 태그를 css로 셀렉트박스 처럼 만들어 놓은 것이지요.
태그를 열어보면 아래와 같이 ul li 그리고 그 속에 button이 있습니다.
실질적인 기능은 이 button이 합니다. ul li는 모양을 거들뿐이죠.
image


목표기능
이것을 아래와 같이 펼쳐진 형태로 만들려면 어떻게 해야 할까요?
image

ul li 태그를 css로 float:left 시킬 수도 있겠지만, 이렇게 하면 10가지가 넘는 언어 모두 보이게 됩니다.
저의 목적은 위와 같이 3개의 언어만 보이게 하는 것 입니다.
그래서 약간의 꼼수를 쓰기로 했습니다.

위 그림에 있는 KOREAN, ENGLISH, CHINESE에 해당하는 버튼을 만들고,
각 버튼을 클릭하면, ul li 속에 있는 특정 button을 클릭하도록 하는 것 입니다.
그리고 <div class="language">을 안보이게 합니다.


코딩
상단 헤더 부분은 layout.html에서 수정 합니다.
전 디폴트 레이아웃에다가 걍 코딩하는 중입니다.(/layouts/xe_official/layout.html)

먼저 버튼 3개를 만듭니다.
<div id="selectLang_ko" style="position:absolute;left:670px;width:86px;height:30px;cursor:pointer;"></div>
<div id="selectLang_en" style="position:absolute;left:756px;width:90px;height:30px;cursor:pointer;"></div>
<div id="selectLang_ch" style="position:absolute;left:846px;width:88px;height:30px;cursor:pointer;"></div>
전 div로 투명버튼을 자주 만듭니다. button으로 하려면 이미지 슬라이싱 해야 하니깐 귀찮습니다. 시간도 걸리구요.
div로 투명버튼을 만드는 방법은 position:absolute해주고, width,height 지정하고, left,top 지정하고, cursor:pointer만 먹여주면 됩니다. 때론 left,top 대신에 margin-left,margin-top을 사용해야 할 때도 있습니다.

그 다음 <ul class="selectLang">에서 특정 버튼들을 얻어 오고, 만들어둔 버튼에 연결시킵니다.
<script type="text/javascript">
// <![CDATA[
jQuery(function($){
    var $btnKo = $('.selectLang button:contains("한국어")');
    var $btnEn = $('.selectLang button:contains("English")');
    var $btnCh = $('.selectLang button:contains("中文(中国)")');
   
    $('#selectLang_ko').click(function(){ $btnKo.click(); });
    $('#selectLang_en').click(function(){ $btnEn.click(); });
    $('#selectLang_ch').click(function(){ $btnCh.click(); });
});
// ]]>
</script>

마지막으로 아래와 같이 셀렉트박스쪽을 안보이게 해줍니다.
없애면 안되고, 안보이게만 해줍니다.
<div class="language" style="display:none;">

image

2013. 12. 20. 08:28


 2013-12-20 오전 8-13-50

위와 같이 서브메뉴가 안보이는 이유는 ‘IE7 표준’으로 랜더링 되었기 때문이다.
브라우저 버전에 상관없이, 랜더링을 IE7으로 되었기 때문이다.
아래 보이는 문서모드를 IE9 또는 표준으로 바꿔주면 정상적으로 서브메뉴가 출력되지만,
이것은 바람직한 해결책이 아니다.

2013-12-20 오전 8-15-59

바람직한 해결책은 HTML HEAD에 랜더링 모드를 강제로 지정하는 것이다.
<meta http-equiv="X-UA-Compatible"  content="IE=9" />
이 태그를 HEAD에 포함시켜주면 브라우저는 HTML을 처음부터 IE9 모드로 출력한다.

그렇다면 제로보드 XE에서 공통 HEAD는 어디에 있을까?
/common/tpl/common_layout.html
바로 이 파일이다. 이 파일에 랜더링 모드를 강제로 지정하는 태그를 포함시켜라.
관리자 뿐만이 아니라 유저사이트에도 공통으로 적용된다.

2013-12-20 오전 8-08-30

'PHP > 제로보드 XE' 카테고리의 다른 글

제로보드 XE-다국어 선택기 펼치기  (0) 2013.12.20
2013. 12. 19. 15:06
[PHP]

http://runean.com/php-1%EC%9D%B8-%EA%B0%9C%EB%B0%9C%ED%99%98%EA%B2%BD/

설치중 xDebug 관련 오류
이클립스로 디버깅 테스트 하는 중 57%에서 프로그레시브바가 멈췄다.
이클립스를 끄고, 브라우저로 열어봤더니, 페이지를 표시 할 수 없다고 나왔다.

아파치쪽 문제라고 판단하고, xDebug 모듈을 갈아 끼워보기 시작했다.(http://xdebug.org/download.php)
xDebug 위자드가 VC9를 쓰라고 분석해 주어서, VC9 들을 갈아 끼워봤지만 동일한 결과가 반복 되었다.

에라 모르겠다 하며, VC6을 끼워봤더니 브라우저에서 잘 표시 되었다.
이클립스로 돌아가 디버깅을 테스트 해보니 브레이크 포인트 잘 걸리고, 변수추적도 잘 된다.


마치며
xDebug 위자드(http://xdebug.org/wizard.php)의 분석 결과대로 해도 안될 때도 있다.
오픈소스이니 이 정도의 수고는 늘 있기 마련이다.

prev"" #1 #2 next