2012. 8. 29. 15:48 Web/javascript
몇일간 고민했던 카테고리별 최신글 추출
lib/latest.lib.php 페이지에 입력
<?
if (!defined('_GNUBOARD_')) exit;
// 최신글 추출
function latest($skin_dir="", $bo_table, $rows=10, $subject_len=40, $options="", $ca_name="")
{
global $g4;
if ($skin_dir)
$latest_skin_path = "$g4[path]/skin/latest/$skin_dir";
else
$latest_skin_path = "$g4[path]/skin/latest/basic";
$list = array();
$sql = " select * from $g4[board_table] where bo_table = '$bo_table'";
$board = sql_fetch($sql);
$tmp_write_table = $g4['write_prefix'] . $bo_table; // 게시판 테이블 전체이름
//함께 출력되는 영역이 있는 경우(서울+부산)
/*if($bo_table == "notice"){
if(trim($ca_name) != ""){
if(trim($ca_name) == "서울"){
$where_query = "and (ca_name='서울' or ca_name='부산')";
}else{
$where_query = "and ca_name='".$ca_name."' ";
}
}else{
$where_query = "";
}
}*/
if ($ca_name)
$sql = " select * from $tmp_write_table where wr_is_comment = 0 and ca_name = '$ca_name' order by wr_num limit 0, $rows ";
else
$sql = " select * from $tmp_write_table where wr_is_comment = 0 order by wr_num limit 0, $rows ";
//explain($sql);
$result = sql_query($sql);
for ($i=0; $row = sql_fetch_array($result); $i++)
$list[$i] = get_list($row, $board, $latest_skin_path, $subject_len);
ob_start();
include "$latest_skin_path/latest.skin.php";
$content = ob_get_contents();
ob_end_clean();
return $content;
}
?>
[기초개념]반복문 while, do while, for (0) | 2013.01.16 |
---|---|
페이지 이동 없이 탭메뉴 자바스크립트로 iframe 효과 내기 (0) | 2012.09.12 |
모바일 전환 스크립트 (0) | 2012.07.27 |
마우스 오른쪽 금지 안내 팝업 (0) | 2012.07.04 |
모바일 페이지로 넘기기 (0) | 2012.05.24 |