테스트 사이트 - 개발 중인 베타 버전입니다

메인에 최신글 내용 추가 채택완료

chembio 9년 전 조회 3,106

홈페이지 메인에 최근 글의 내용과 썸네일을 함께 불러오고 싶습니다.

 

다음과 같은 코드로

pa 스킨으로 preview 게시판의 글을 2개 게시하며 글자 50자까지 노출되게 한다.

까지 이해했습니다(혹시 잘못이해 한 것이 있다면 지적 부탁드립니다)

 

그런데 내용 50자가 노출이 되지 않습니다.

제가 내린 결론으로는 pa skin에 내용 코드를 추가해줘야 할 것 같습니다.

전문 개발자가 아닌 일개 대학원생이라 그누보드에 대한 기반 지식이 부족합니다.

스킨 파일 코드에서 어디에 어떤 코드를 추가해야할 지 가르침 좀 부탁드립니다.

감사합니다.

 

</p><p><?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가 </p><p>$cols  = 1; //  이미지 가로갯수 //  이미지 세로 갯수는 메인에서 지정(총 이미지 수)
$image_h  = 1; // 이미지 상하 간격
$col_width = (int)(99 / $cols);</p><p>$img_width = 250; //썸네일 가로길이 
$img_height = 70; //썸네일 세로길이 
$img_quality = 100; //퀼리티 100이하로 설정 일부 php버전에서는 10이하의 수로 처리 될 수 있삼</p><p>if (!function_exists("imagecopyresampled")) alert("GD 2.0.1 이상 버전이 설치되어 있어야 사용할 수 있는 갤러리 게시판 입니다.");</p><p>$data_path = $g4[path]."/data/file/$bo_table";
$thumb_path = $data_path.'/thumb_img_list'; //썸네일 이미지 생성 디렉토리</p><p>@mkdir($thumb_path, 0707);
@chmod($thumb_path, 0707);</p><p>?></p><p><? for ($i=0; $i<count($list); $i++) { ?>
<?
$wr_content = "<a href='{$list[$i]['href']}'>".cut_str(strip_tags($list[$i]['wr_content']), 350, '...')."</a>";
 //   if ($i>0 && $i%$cols==0) { echo "<td colspan='$cols' height='$image_h'></td><tr>"; }
    $img = "<img src='$g4_path/img/noimage.gif' border=0 width='$img_width' height='$img_height' title='이미지 없음' align=left style='margin-right:5px; border:1 #222222 solid;'>";
    $thumb = $thumb_path.'/'.$list[$i][wr_id];
 
 
 // 섬네일과 새로 올린파일 날짜를 비교하여 셈네일을 갱신하기위해서 지운다.
 if ( file_exists($thumb) && (filemtime($thumb) < filemtime($list[$i][file][0][path] .'/'. $list[$i][file][0][file])) ) {
  @unlink($thumb);
 }
 
    // 썸네일 이미지가 존재하지 않는다면
    if (!file_exists($thumb)) {
        $file = $list[$i][file][0][path] .'/'. $list[$i][file][0][file];
        // 업로드된 파일이 이미지라면
  //echo $i;
        if (preg_match("/\.(jp[e]?g|gif|png)$/i", $file) && file_exists($file)) {
            $size = getimagesize($file);
            if ($size[2] == 1)
                $src = imagecreatefromgif($file);
            else if ($size[2] == 2)
                $src = imagecreatefromjpeg($file);
            else if ($size[2] == 3)
                $src = imagecreatefrompng($file);
            else
                break;</p><p>            $rate = $img_width / $size[0];
            $height = (int)($size[1] * $rate);
   $width = (int)($size[0] * $rate);</p><p>            // 계산된 썸네일 이미지의 높이가 설정된 이미지의 높이보다 작다면
            $dst = imagecreatetruecolor($img_width, $img_height);</p><p>            if ($height < $img_height) {                // 계산된 이미지 높이로 복사본 이미지 생성
    imagecopyresampled($dst, $src, 0, 0, 0, 0, $width, $img_height, $size[0], $size[1]);
    imagejpeg($dst, $thumb_path.'/'.$list[$i][wr_id], $img_quality);
            } else {   // 설정된 이미지 높이로 복사본 이미지 생성
    imagecopyresampled($dst, $src, 0, 0, 0, 0, $img_width, $height, $size[0], $size[1]);
    imagejpeg($dst, $thumb_path.'/'.$list[$i][wr_id], $img_quality);
   
   }
   //echo $i;
            chmod($thumb_path.'/'.$list[$i][wr_id], 0606);
        }
    }</p><p>    if (file_exists($thumb))
        $img = "<img src='$thumb' border=0>";
?>
<?
        $datetime = substr($list[$i][wr_datetime],0,10); 
        $datetime2 = $list[$i][wr_datetime]; 
         
        if ($list[$i]['wr_datetime'] >= date("Y-m-d H:i:s", $g4['server_time'] - ($row['bo_new'] * 3600))) $comment_new = "new";</p><p>        if ($datetime == $g4[time_ymd]) 
            $datetime2 = substr($datetime2,11,5); 
        else 
            $datetime2 = substr($datetime2,5,5); 
   
    $list[$i][datetime] = $datetime; 
    $list[$i][datetime2] = $datetime2; 
    
    $a[$i] = array( 
      "wr_date"=>$datetime2,
);
?></p><p><?
 $rw_subject = cut_str(stripslashes($list[$i][subject]),$subject_size,'..');
 $a_link="<a href='{$list[$i][href]}'>$rw_subject</a>";
 $a_img="<a href='<a href="<a href="http://chem.yonsei.ac.kr/~injae/gnuboard4/bbs/preview3.php?bo_table=papers_2&wr_id={$list[$i][wr_id]}" target="_blank" rel="noopener noreferrer">http://chem.yonsei.ac.kr/~injae/gnuboard4/bbs/preview3.php?bo_table=papers_2&wr_id={$list[$i][wr_id]}</a>"><a href="http://chem.yonsei.ac.kr/~injae/gnuboard4/bbs/preview3.php?bo_table=papers_2&wr_id={$list[$i][wr_id]}" target="_blank" rel="noopener noreferrer">http://chem.yonsei.ac.kr/~injae/gnuboard4/bbs/preview3.php?bo_table=papers_2&wr_id={$list[$i][wr_id]}</a></a>'>$img</a>";
 $a_comment="<a href=\"{$list[$i][comment_href]}\"><span class='commentFont'>{$list[$i]['comment_cnt']}</span></a>";
 $rw_content = cut_str(stripslashes($list[$i][wr_content]),$content_size,' ..more');
 $rw_content = strip_tags($rw_content);
 $a_content = cut_str(strip_tags($list[$i][wr_content]), 230, '...');
?>
<?=$a_img?>
<? </p><p>
echo "
<a href='<a href="<a href="http://chem.yonsei.ac.kr/~injae/gnuboard4/bbs/preview3.php?bo_table=papers_2&wr_id={$list[$i][wr_id]}" target="_blank" rel="noopener noreferrer">http://chem.yonsei.ac.kr/~injae/gnuboard4/bbs/preview3.php?bo_table=papers_2&wr_id={$list[$i][wr_id]}</a>"><a href="http://chem.yonsei.ac.kr/~injae/gnuboard4/bbs/preview3.php?bo_table=papers_2&wr_id={$list[$i][wr_id]}" target="_blank" rel="noopener noreferrer">http://chem.yonsei.ac.kr/~injae/gnuboard4/bbs/preview3.php?bo_table=papers_2&wr_id={$list[$i][wr_id]}</a></a>'><span style='font-size:10pt;font-family:tahoma;color:#4D5F85'><b>";
echo "".cut_str(strip_tags($list[$i]['wr_content']), 120, '...')."</b>

</a>"; </p><p>?><? } ?>
<? echo "</a>"; ?>
<? echo "<img src='";?><?=$latest_skin_path?><? echo "/img/line.jpg'>"; ?> 

댓글을 작성하려면 로그인이 필요합니다.

답변 5개

채택된 답변
+20 포인트
l
9년 전

 $rw_subject = cut_str(stripslashes($list[$i][subject]),50,'..');

 $a_link="$rw_subject";

 $a_img="$img";

 $a_comment="{$list[$i]['comment_cnt']}";

 $rw_content = cut_str(stripslashes($list[$i][wr_content]),50,' ..more');

 

$subject_size, $content_siz 를 50으로 모두 바꾸고 한번 해보세요..  81라인부터네요.

 

그리고 이것도 안나오면 

$rw_subject = stripslashes($list[$i][subject]);
$rw_content = stripslashes($list[$i][wr_content]);
이렇게도 해보세요.
제한없이 출력하는 건데.. 이것도 안되면.. 전체코드를 봐야 할 듯 합니다... 
로그인 후 평가할 수 있습니다

답변에 대한 댓글 1개

c
chembio
9년 전
92 93 라인을 수정하니 해결 되었습니다.
다만 이전에는 게시글의 글씨체/기울임 볼드 등을 따라갔었는데
이제는 Tahoma로 나오네요 92줄의 영향인듯합니다.

댓글을 작성하려면 로그인이 필요합니다.

l
9년 전

흠.. 해결되셨다니 다행이네요.. 그 라인이 영향을 주지 않을거 같은데 해결이 되네요..^^;

폰트는 아시다시피 

font-family:tahoma; 

이 구문때문에 영향을 받습니다. 삭제하시면 페이지에 설정되는 폰트로 나올꺼에요.

로그인 후 평가할 수 있습니다

댓글을 작성하려면 로그인이 필요합니다.

9년 전

 

여기에서 50 은 제목의 길이입니다. subject

내용(content) 의 길이가 아닙니다. 

 

로그인 후 평가할 수 있습니다

댓글을 작성하려면 로그인이 필요합니다.

l
9년 전

안된다는건 제목이 보여야할 자리에 공백으로 아무것도 안나온다는 이야기시죠?

로그인 후 평가할 수 있습니다

답변에 대한 댓글 1개

c
chembio
9년 전
네 글 내용이 보여야 할 자리에 공백입니다. 섬네일은 정상적으로 출력 됩니다.

댓글을 작성하려면 로그인이 필요합니다.

l
9년 전

위 코드로만 보면...

85라인의 $rw_content = cut_str(stripslashes($list[$i][wr_content]),$content_size,' ..more'); 에서 content_size가 안보이는듯해요.. $content_size 를 50으로 해서 테스트해보세요.

로그인 후 평가할 수 있습니다

답변에 대한 댓글 1개

c
chembio
9년 전
댓글 감사합니다.
'..more' 대신'50'을 넣어도 내용은 안나오고, '50', $content_size='50' 등으로 바꾸었는데도 내용은 출력이 안됩니다.
+$content_size 자리 자체를 50으로 바꾸어보았습니다만 역시 안되네요

댓글을 작성하려면 로그인이 필요합니다.

답변을 작성하려면 로그인이 필요합니다.

로그인