원초적 질문 (부제:질문해서 죄송합니다) > 그누4 질문답변

그누4 질문답변

그누보드4 관련 질문은 QA 로 이전됩니다. QA 그누보드4 바로가기
기존 게시물은 열람만 가능합니다.

원초적 질문 (부제:질문해서 죄송합니다) 정보

원초적 질문 (부제:질문해서 죄송합니다)

본문

php 를 모르고 홈페이지를 운영하려고 하니까 어려움이 이만저만이 아닙니다.
역시 초보의 길은 쉽지 않네요.... 휴... ㅠㅠ
 
태엽푸는새님의 최근 게시물을 사용하고 있는데 공교롭게도 글 자르기가 되지 않습니다.
 
예를 들어 "그누보드 정말 멋지고 좋아요" 라는 글이 있으면 제목에 "그누보드 정말 멋지고..." 라고 표현하고 싶은데 어떻게 하는지 잘 모르겠습니다.
 
간단할거 같은데... 소경이 길을 찾다보니 질문을 할 수 밖에 없었습니다.
조금씩 노력하고 있으니 꼭 좀 도와주시길 부탁드립니다.
 
아래는 태엽푸는새님의 소스입니다.
 
 
 
<?php
/*
 사용 예) <?php echo my_new(20, 40, "120px");
*/
function get_new($rowCnt, $maxStr)
{
 global $g4, $gr_id, $config;
 $maxRow = 200;
 
 $s = "
  select
   a.*, b.bo_subject, c.gr_subject, c.gr_id
  from
   $g4[board_new_table] a,
   $g4[board_table] b,
   $g4[group_table] c
  where
   a.bo_table = b.bo_table
   and b.gr_id = c.gr_id
   and b.bo_use_search = '1'
  order by a.bn_id desc
  limit $maxRow
  ";
 $i = 0;
 $res = mysql_query($s);
 while ($row = mysql_fetch_array($res))
 {
  if ($i >= $rowCnt) break;
  
  if ($row[wr_id] == $row[wr_parent]) // 원글이라면
  {
   $s = "
    select wr_id, wr_subject, wr_comment, wr_datetime
    from $g4[write_prefix]$row[bo_table]
    where wr_id = '$row[wr_id]'
    ";
   $list[$i] = mysql_fetch_array(mysql_query($s));
   $list[$i][commentCnt] = $list[$i][wr_comment];
   $list[$i][subject] = cut_str(get_text($list[$i][wr_subject]), $maxStr);
   $list[$i][href] = "$g4[bbs_path]/board.php?bo_table=$row[bo_table]&wr_id={$list[$i][wr_id]}";
   $list[$i][title] = addslashes(get_text($list[$i][wr_subject])." / ".$list[$i][wr_datetime]);
   $i++;
  }
 }
 
 return $list;
}
function my_new($rowCnt = 10, $maxStr = 20, $maxWidth = "100%") { global $g4; $list = get_new($rowCnt, $maxStr); ?>
<table width="200" border="0" cellpadding="0" cellspacing="1" bgcolor="99CC66">
    <tr>
        <td>
            <table width="200" border="0" cellpadding="0" cellspacing="4" bgcolor="99CC66">
                <tr>
                    <td valign="top" bgcolor="FFFFFF" style="padding:0px">
<table width="200" cellpadding=0 cellspacing=0>
<tr><td>
    <table width="200" border="0" cellspacing="0" cellpadding="0">
          <tr bgcolor=#99CC66>
              <td width="10"></td>
              <td height="23"><strong><a href="<?=$g4['bbs_path']?>/new.php">KOISRA Recent Updated</a></strong></td>
              <td width="5"></td>
          </tr>
          <tr>
                <td colspan=4 height="1" bgcolor=#ececec></td>
          </tr>
      </table>
</td></tr>
 <?php $n = count($list); for ($i = 0; $i < $n; $i++) { ?>
<tr>
    <td colspan=4 align=center>
        <table width=95%>
        <tr>
            <td height=19>
  <nobr style='display:block; overflow:hidden; width:160;'>
  <span style="font-weight:normal;">
  <!-- 코멘트 수 -->
  <?php if ($list[$i][commentCnt]) { ?>
  <font color="tomato">(<?php echo $list[$i][commentCnt]; ?>)</font>
  <?php } ?>
  <!-- // 코멘트 수 -->
  <!-- 제목 -->
        <a href="<?php echo $list[$i][href]; ?>" title="<?php echo $list[$i][title]; ?>">
  <?php echo $list[$i][subject]; ?>
  <!-- // 제목 -->
  </span>
  </a>
       </nobr>
</td></tr>
        </table></td>
</tr>
 <?php } ?>
</table>
</td></tr>
</table>
</td></tr>
</table>
<table width="200" cellpadding=0 cellspacing=0>
<tr><td height=5></td></tr>
</table>
<?php } ?>

댓글 전체

저도 코드는 잘 모르지만 얼추, 생각을 해보시면 답이 나올듯합니다.

그리고 몰라서 질문하는것은 잘못된게 아니니~ 열심히 질문하고 공부하시고 하면 됩니다.

저도 초보라 ^0^

function my_new($rowCnt = 10, $maxStr = 20, $maxWidth = "100%") { global $g4; $list = get_new($rowCnt, $maxStr);

이부분을 보시면,  my_new 함수를 새로 정의해서 쓰는데 그때 사용하는 변수들을 초기값을 주는군요..

rowCnt => 아마 10줄..그러니까 한페이지에서 10줄의 새글을 불러오는것으로 보이는군요..Cnt는 Count 겠죠..숫자..
maxStr => 이게 20자...그러니까 한줄한줄의 게시물의 제목의 글자수를 제한하는 것입니다. maxString 최대글자수..
maxWidth =>게시물을 20자만 보여주기를 10줄을 하는데 해당 함수가 아마 테이블단위로 구성을 하는거라 길이를 고정하지않고 %로 줘서 유연성있게 보여주는것으로 사료됩니다.

저도 초보에요..프로그램은 C밖에 안해봤고 ..아직 php , asp 잘 모르지만 배우고싶으시다면 뭐든 열심히 공부하고

모르는것은 질문하면 됩니다.

모르는것은 잘못된게 아니라는거, 다시한번 강조해드리고~ 그누에서 많은것들 얻어가시기 바랍니다.

ps. -_- php좀 가르쳐주실분?????????/// *** 개인정보보호를 위한 이메일주소 노출방지 *** <------- 79추가 급급 ㅎㅎ
전체 66,554 |RSS
그누4 질문답변 내용 검색

회원로그인

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