최근게시물 질문입니다. 어렵네요... > 그누3질답

그누3질답

최근게시물 질문입니다. 어렵네요... 정보

그누보드 최근게시물 질문입니다. 어렵네요...

본문

하나의 최근게시물에 여러 게시판의 내용을 보여줄려고 합니다.
검색을 하다가 어떤 소스를 찾았는데... 제가 하고 싶은것은 웹진,신문사이트 처럼 제목과 이미지, 글내용이 같이 나오게 하고 싶습니다. 좀더 하고 싶다면 일반 최근게시물처럼 불러오는 최근게시물 하나하나의 글크기 와 이미지크기를 조절하고 싶은데 어떻게 할 수 없을까요?

------------소스---------

              <?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가

define("_DOCTYPE_", "DESIGN");

$html_title = "그누보드3";
?>
<!-- 연재 -->
                <table width=100% cellpadding=0 cellspacing=0>
                <tr><td height=1 background='./bbs/line.gif'></td></tr>
                <tr class='subject subjectbg ht'><td colspan=2> 연재</td></tr>
                <tr><td height=1 background='./bbs/line.gif'></td></tr>
                <?
                $max_i =10; // 출력갯수
                $wtime = date("Y-m-d H:i:s", time()-86400*14);
                $arr_series = array("school", "study", "daegu1318", "culture","union","project");
                for ($i=0; $i<count($arr_series); $i++) {
                    $sql = " select wr_id, wr_subject, wr_datetime, wr_content from $cfg[write_table_prefix]{$arr_series[$i]} where wr_comment = 0 and wr_datetime > '$wtime' ";
                    $result = sql_query($sql);
                    while ($row=mysql_fetch_array($result)) {
                        $aseries[$row[wr_datetime].$arr_series[$i]][table]    = $arr_series[$i];
                        $aseries[$row[wr_datetime].$arr_series[$i]][datetime] = $row[wr_datetime];
                        $aseries[$row[wr_datetime].$arr_series[$i]][id]      = $row[wr_id];
                        $aseries[$row[wr_datetime].$arr_series[$i]][subject]  = $row[wr_subject];
                        $aseries[$row[wr_datetime].$arr_series[$i]][content]      = $row[wr_content];
                    }
                }

                @krsort($aseries);
                $xtime = date("Y-m-d H:i:s", time()-86400*3);
                $i=0;
                foreach ($aseries as $key=>$value) {
                    if ($i++ >= $max_i) break;
                    $subject = conv_subject($value[subject], 60,"…");
                    $new = "";
                    if ($value[datetime] > $xtime) {
                        $new = "<img src='$latest_skin/icon_new.gif' align=absmiddle> ";
                    }
                    if ($value[content]) {
                                  $content = cut_str($value[content], 150,"…");

                    }
                    echo "<tr><td height=22>$new<a href='./?doc=$cfg[bbs_dir]/gnuboard.php&bo_table=$value[table]&wr_id=$value[id]'><font color='#CD233D' style='MARGIN-TOP: 1px; FONT-WEIGHT: bold; FONT-SIZE: 20px; MARGIN-LEFT: 0px; FONT-FAMILY: '돋음'; COLOR: #CD233D; letter-spacing:-1px; line-height: 17px;'>$subject</font></a><br>$content<br></td></tr>";
                }
                ?>
                </table>

댓글 전체

####################################################################
시간이 없어서 감만 잡게 답변 드리겠습니다.


스킨방에 gbview.skon.php 의 팁중에 이걸 먼저 이해를 하셔야 될겁니다.
10년된 함수죠... 바로 이 부분입니다. 이미지 자동리사이징 입니다.
<tr>
<td style='word-break:break-all;' class='lh' height=100>
<?
for ($i=1; $i<=$cfg[file_count]; $i++) {
여기서 해주겠죠?
}


####################################################################
일단 그누가 for 문으로 돌아가니까
이 for 문 안에서 안에서 제 1번 파일만 예로 들겠습니다.

if($i==1){
if ($file[$i][source]){ //즉 업로드된 파일이 있으면 해야갰죠?
//파일이 있으면 저장을 합니다. $P_FIle 에..
$P_File="data/file/$bo_table/".$write["wr_file".$i];

$TABLE_width=640;
$imgwidth=$TABLE_width-6; //그림의 최대가로크기는 테이블에서 6픽셀 정도 마이너스.

//++++++++++++++++++++++++++++++++++++++++++++
if(file_exists($P_File)){
$file_src=$P_File;
$size = getimagesize($file_src);
$width_A = $size[0]; $height_A = $size[1]; $max_w = $imgwidth; $max_h = 4096;
$rate_h = $height_A/$max_h; $rate_w = $width_A/$max_w;
if($height_A > $max_h || $width_A > $max_w) {
if(($height_A > $max_h && $width_A > $max_w && $rate_w > $rate_h) || ($height_A < $max_h && $width_A > $max_w)) {$rate = $rate_w;}
elseif(($height_A >= $max_h && $width_A >= $max_w && $rate_w < $rate_h) || ($height_A >= $max_h && $width_A < $max_w)) {$rate = $rate_h;} } else {$rate = 1;}
$resize_h = $height_A/$rate; $resize_w = $width_A/$rate; $newsize = array($resize_w,$resize_h);
//++++++++++++++++++++++++++++++++++++++++++++
$img_width_A =$newsize[0]; $img_height_A =$newsize[1]; } //file_exists
else{ $img_width_A = 99; $img_height_A = 54;} //if P_File
//++++++++++++++++++++++++++++++++++++++++++++
$File_View="<img src='$P_File' width='$img_width_A' height='$img_height_A'>";
//일단 그림의 [가로길이만] 다른 변수로 저장.
//이건 이미지가 작을 경우 글을 볼경우 글은 우측에 나와야 죠..크다면 글이 아래에 나와야 구색이
맞춰집니다.
$File_View_Size=$img_width_A;

//그림의 크기는 이렇게 표시합니다.
$garosize=$size[0]; 가로싸이즈
$serosize=$size[1]; 세로싸이즈

$File_View_Pyosi ='YES';
//이미지는 여기서 보여주지 않고 내용출력에서 결정함. 다음라인 확인스텝.
//echo"$File_View";
}
}

View 에서의 파일싸이즈는
$파일싸이즈= filesize("data/file/$bo_table/".$write["wr_file".$i]);

질문내용에서처럼 글내용대로라면 글의길이는
$글의길이=strlen($row[wr_content]);
요렇게 되지 않을까요?

메인에서 응용도 조금 고생하시면 될것입니다.
이런 부분은 주로 감을 잡는게 중요합니다. 플러그인이 아닌이상...;;
그럼..;;
전체 9,564
그누3질답 내용 검색

회원로그인

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