<?
include 'Main.asp';
$objMain = new Main($dbconn); //dbconn커넥션을 인자로 전달합니다.
$arrData = $objMain->listBoard($board_name, $bid, $num, $str_length); //게시판 이름, 멀티보드일경우 인자값, 리스트에 출력될 게시물 수, 타이틀이 보여질 글자수
//에러 검출용 함수 사용시
$objMain->printErr();
for($i=0; i<count($arrData); i++){
echo $arrData[i][title]; //해당 필드를 나열해 주시면 됩니다.
}
/////////////////////////////
// - class.Main.php
/////////////////////////////
class Main
{
var $dbconn;
var $sql;
var $error_msg;
function Main($dbconn){
$this->dbconn = $dbconn;
}
function listBoard($board_name, $bid, $num=3, $str_length=50){
$this->sql = "select uid, title, doc, left(content,100) as content, (date_sub(curdate(), interval 5 DAY)<=wdate) as is_new
from $board_name
where bid=$bid
order by wdate desc limit $num";
$result = mysql_query($this->sql, $this->dbconn);
if($result){
$i=0;
while($row = mysql_fetch_object($result)){
$info[$i][uid] = $row->uid;
$info[$i][title] = stripslashes($row->title);
$info[$i][content] = stripslashes($row->content);
$info[$i][is_new] = $row->is_new;
$info[$i][doc] = $row->doc;
if(strlen($info[$i][title]) > $str_length)
$info[$i][title] = $this->ksubstr($info[$i][title],0,$str_length);
if($info[$i][is_new])
$info[$i][title] .= ' <img src="images/btn_new.gif" border="0">';
$i++;
}
return $info;
}
else {
$this->error_msg = mysql_error();
return false;
}
}
function printErr(){
echo "<br>SQL : ".$this->sql;
echo "<br>ERR : ".$this->error_msg;
}
// 한글용 ksubstr //
function ksubstr($string,$start,$length){
if($length>=strlen($string)) return $string;
$klen=$length-1;
while(ord($string[$klen]) & 0x80) $klen--;
return $add.substr($string,$start,$length-(($length+$klen+1)%2));
}
}
?><div class='small'>[이 게시물은 관리자님에 의해 2011-10-31 17:12:10 PHP & HTML에서 이동 됨]</div>
include 'Main.asp';
$objMain = new Main($dbconn); //dbconn커넥션을 인자로 전달합니다.
$arrData = $objMain->listBoard($board_name, $bid, $num, $str_length); //게시판 이름, 멀티보드일경우 인자값, 리스트에 출력될 게시물 수, 타이틀이 보여질 글자수
//에러 검출용 함수 사용시
$objMain->printErr();
for($i=0; i<count($arrData); i++){
echo $arrData[i][title]; //해당 필드를 나열해 주시면 됩니다.
}
/////////////////////////////
// - class.Main.php
/////////////////////////////
class Main
{
var $dbconn;
var $sql;
var $error_msg;
function Main($dbconn){
$this->dbconn = $dbconn;
}
function listBoard($board_name, $bid, $num=3, $str_length=50){
$this->sql = "select uid, title, doc, left(content,100) as content, (date_sub(curdate(), interval 5 DAY)<=wdate) as is_new
from $board_name
where bid=$bid
order by wdate desc limit $num";
$result = mysql_query($this->sql, $this->dbconn);
if($result){
$i=0;
while($row = mysql_fetch_object($result)){
$info[$i][uid] = $row->uid;
$info[$i][title] = stripslashes($row->title);
$info[$i][content] = stripslashes($row->content);
$info[$i][is_new] = $row->is_new;
$info[$i][doc] = $row->doc;
if(strlen($info[$i][title]) > $str_length)
$info[$i][title] = $this->ksubstr($info[$i][title],0,$str_length);
if($info[$i][is_new])
$info[$i][title] .= ' <img src="images/btn_new.gif" border="0">';
$i++;
}
return $info;
}
else {
$this->error_msg = mysql_error();
return false;
}
}
function printErr(){
echo "<br>SQL : ".$this->sql;
echo "<br>ERR : ".$this->error_msg;
}
// 한글용 ksubstr //
function ksubstr($string,$start,$length){
if($length>=strlen($string)) return $string;
$klen=$length-1;
while(ord($string[$klen]) & 0x80) $klen--;
return $add.substr($string,$start,$length-(($length+$klen+1)%2));
}
}
?><div class='small'>[이 게시물은 관리자님에 의해 2011-10-31 17:12:10 PHP & HTML에서 이동 됨]</div>
게시판 목록
프로그램
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 1330 | 18년 전 | 1477 | ||
| 1329 | 18년 전 | 1701 | ||
| 1328 | 18년 전 | 995 | ||
| 1327 | 18년 전 | 1395 | ||
| 1326 | 18년 전 | 2243 | ||
| 1325 | 18년 전 | 1127 | ||
| 1324 | 18년 전 | 1295 | ||
| 1323 | 18년 전 | 1560 | ||
| 1322 | 18년 전 | 1175 | ||
| 1321 | 18년 전 | 963 | ||
| 1320 | 18년 전 | 1185 | ||
| 1319 | 18년 전 | 1517 | ||
| 1318 | 18년 전 | 1639 | ||
| 1317 | 18년 전 | 1594 | ||
| 1316 | 18년 전 | 1206 | ||
| 1315 |
|
18년 전 | 8596 | |
| 1314 | 18년 전 | 1896 | ||
| 1313 | 18년 전 | 1489 | ||
| 1312 | 18년 전 | 1483 | ||
| 1311 | 18년 전 | 1769 | ||
| 1310 | 18년 전 | 1829 | ||
| 1309 | 18년 전 | 1215 | ||
| 1308 | 18년 전 | 976 | ||
| 1307 | 18년 전 | 2738 | ||
| 1306 | 18년 전 | 3100 | ||
| 1305 | 18년 전 | 2162 | ||
| 1304 | 18년 전 | 1553 | ||
| 1303 | 18년 전 | 1406 | ||
| 1302 | 18년 전 | 853 | ||
| 1301 | 18년 전 | 1771 | ||
| 1300 | 18년 전 | 5131 | ||
| 1299 | 18년 전 | 2843 | ||
| 1298 |
mixdesign
|
18년 전 | 2097 | |
| 1297 | 18년 전 | 3074 | ||
| 1296 | 18년 전 | 2537 | ||
| 1295 | 18년 전 | 2230 | ||
| 1294 |
onweb
|
18년 전 | 4551 | |
| 1293 |
onweb
|
18년 전 | 3485 | |
| 1292 | 18년 전 | 3448 | ||
| 1291 | 18년 전 | 4029 | ||
| 1290 | 18년 전 | 1904 | ||
| 1289 | 18년 전 | 1753 | ||
| 1288 | 18년 전 | 1719 | ||
| 1287 | 18년 전 | 1414 | ||
| 1286 | 18년 전 | 1258 | ||
| 1285 | 18년 전 | 1151 | ||
| 1284 | 18년 전 | 1158 | ||
| 1283 | 18년 전 | 1508 | ||
| 1282 | 18년 전 | 897 | ||
| 1281 | 18년 전 | 1268 | ||
| 1280 | 18년 전 | 1120 | ||
| 1279 | 18년 전 | 1136 | ||
| 1278 | 18년 전 | 3016 | ||
| 1277 | 18년 전 | 944 | ||
| 1276 | 18년 전 | 1151 | ||
| 1275 | 18년 전 | 2087 | ||
| 1274 | 18년 전 | 2220 | ||
| 1273 | 18년 전 | 1309 | ||
| 1272 | 18년 전 | 1899 | ||
| 1271 | 18년 전 | 1150 | ||
| 1270 | 18년 전 | 2485 | ||
| 1269 | 18년 전 | 6591 | ||
| 1268 |
페이지팩트
|
18년 전 | 3820 | |
| 1267 |
페이지팩트
|
18년 전 | 2220 | |
| 1266 |
|
18년 전 | 6287 | |
| 1265 | 18년 전 | 2568 | ||
| 1264 | 18년 전 | 2614 | ||
| 1263 | 18년 전 | 2109 | ||
| 1262 | 18년 전 | 2104 | ||
| 1261 |
페이지팩트
|
18년 전 | 2115 | |
| 1260 | 18년 전 | 3871 | ||
| 1259 |
|
18년 전 | 3929 | |
| 1258 |
|
18년 전 | 5031 | |
| 1257 | 18년 전 | 4123 | ||
| 1256 | 18년 전 | 2562 | ||
| 1255 | 18년 전 | 1793 | ||
| 1254 | 18년 전 | 2774 | ||
| 1253 | 18년 전 | 2710 | ||
| 1252 | 18년 전 | 2227 | ||
| 1251 | 18년 전 | 5410 | ||
| 1250 |
jbsstyle
|
18년 전 | 4750 | |
| 1249 |
|
18년 전 | 3758 | |
| 1248 | 18년 전 | 3444 | ||
| 1247 | 18년 전 | 2122 | ||
| 1246 | 18년 전 | 2129 | ||
| 1245 | 18년 전 | 3631 | ||
| 1244 |
|
18년 전 | 2265 | |
| 1243 |
|
18년 전 | 2491 | |
| 1242 | 18년 전 | 1759 | ||
| 1241 | 18년 전 | 4455 | ||
| 1240 | 18년 전 | 2148 | ||
| 1239 | 18년 전 | 2297 | ||
| 1238 | 18년 전 | 4035 | ||
| 1237 |
hwatta
|
18년 전 | 3883 | |
| 1236 | 18년 전 | 2110 | ||
| 1235 | 18년 전 | 2757 | ||
| 1234 | 18년 전 | 5139 | ||
| 1233 | 18년 전 | 2400 | ||
| 1232 |
|
18년 전 | 2941 | |
| 1231 | 18년 전 | 8497 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기