신규 포스트 특정 아이디(블로그)만 출력하게 하려면? 정보
신규 포스트 특정 아이디(블로그)만 출력하게 하려면?
본문
어떻게 하나요?
<?
//섬네일 관련 설정
$t_width=100;//섬네일 최대폭
$t_height=70;//섬네일 최대높이
$quality = 80;
$sql = " select * from {$gb4['post_table']} where secret=1 order by id desc limit 50 ";
$result = sql_query($sql);
for($i=0;$row=sql_fetch_array($result);$i++) {
if ($i>0) {
}
$sql2 = " select mb_id, writer from {$gb4['blog_table']} where id = '$row[blog_id]' ";
$row2 = sql_fetch($sql2);
$sql3 = " select category_name from {$gb4['category_table']} where id = '$row[category_id]' ";
$row3 = sql_fetch($sql3);
if( empty($row3[category_name]) ) $row3[category_name] = '전체';
$title = $row[title];
$title = cut_str($title, 35);
$content = $row[content];
$content = strip_tags($content);
$content = cut_str($content, 350);
$yymmdd2 = date("y-m-d", strtotime($row[real_date]));
$sql4 = " select * from {$gb4['file_table']} where blog_id = '$row[blog_id]' and post_id = '$row[id]' ";
$row4 = sql_fetch($sql4);
$thumb = $g4[path]."/data/blog/file/".$row2[mb_id]."/".$row4[save_name]."_thumb";
if (!file_exists($thumb))
{
$file = $g4[path]."/data/blog/file/".$row2[mb_id]."/".$row4[save_name];
// 업로드된 파일이 이미지라면
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;
$rate = $t_width / $size[0];
$height = (int)($size[1] * $rate);
@unlink($thumb);
// 계산된 썸네일 이미지의 높이가 설정된 이미지의 높이보다 작다면
if ($height < $t_height){
// 계산된 이미지 높이로 복사본 이미지 생성
$dst = imagecreatetruecolor($t_width, $height);
} else {
// 설정된 이미지 높이로 복사본 이미지 생성
$dst = imagecreatetruecolor($t_width, $t_height);
}
imagecopyresampled($dst, $src, 0, 0, 0, 0, $t_width, $height, $size[0], $size[1]);
imagejpeg($dst, $thumb, $quality);
chmod($thumb, 0606);
}
}
if (file_exists($thumb)){ $img = "<img src='$thumb' border=0 width='100'>"; }
echo "<tr><td height=30 valign=middle>";
echo "<img src='$g4[path]/img/image/icon_point.gif' width=5 height=5 border=0 align=absmiddle> <span class='cloudy small'>[ </span><a href='".get_post_url($row[id],$row2[mb_id])."' target='_blank'>$row2[writer]님 Blog </a><span class='cloudy small'> / </span><a href='".get_post_url($row[id],$row2[mb_id])."' target='_blank'>$row3[category_name]</a><span class='cloudy small'> ]</span> ";
echo "<span style='font-weight:bold;letter-spacing:-1px;'><a href='".get_post_url($row[id],$row2[mb_id])."' target='_blank'>$title</a> <span class='small cloudy'>$yymmdd2</td></tr>";
if ($img) {
if($row[id] == $row4[post_id]){
echo "</table><table width=95% cellpadding=0 cellspacing=0 align=center>";
echo "<tr><td width=100 style='border:1px solid #CCCCCC; padding:3px'><a href='".get_post_url($row[id],$row2[mb_id])."' target='_blank'>{$img}</a></td><td width=10></td><td valign=top><span style='small'><a href='".get_post_url($row[id],$row2[mb_id])."' target='_blank'>{$content}</a></span></td></tr></table><table width=95% cellpadding=0 cellspacing=0 align=center>";
} else {
echo "<tr><td><span style='small'>{$content}</span></td></tr>";
}
}
else {
echo "<tr><td><span style='small'>{$content}</span></td></tr>";
}
echo "<tr><td height=10></td></tr>";
echo "<tr><td height=1 bgcolor=#d2d2d2></td></tr>";
}
if ($i==0) {
echo "<tr><td height=100>새로 올라온 글이 아직 없습니다.</td></tr>";
}
?>
</table>
이게 일반페이지에 불러져오는 신규포스트입니다.
$row[blog_id] 대신에 블로그 아이디를 넣어도 안되네요...
도와주세요~~
댓글 전체

$t_width=100;//섬네일 최대폭
$t_height=70;//섬네일 최대높이
$quality = 80;
$sql = " select * from {$gb4['post_table']} where mb_id='$mb_id' and secret=1 order by id desc limit 50 ";
코드처럼 mb_id='아이디' and 를 추가해보시기 바랍니다.

...
안되네요... ㅜ.ㅜ
select * from gb4_post where mb_id='fotohaam' and secret=1 order by id desc limit 50
1054 : Unknown 칼럼 'mb_id' in 'where clause'
이렇게 뜹니다... 에휴...
mb_id 대신 blog_id 를 넣으니 "아직 올라온 글이 없습니다..." 라고 포스트 출력을 거부하네요... -_-;;;