묻고답하기
page_full_width" class="col-xs-12" |cond="$__Context->page_full_width">
날짜순 정렬.
2006.01.08 18:49
http://www.nzeo.com/bbs/zboard.php?id=cgi_zskins2&page=1&sn1=&divpage=3&sn=off&ss=on&sc=off&keyword=플래쉬&select_arrange=headnum&desc=asc&no=17328제로보드를 사용한 스케줄러 하나 짜고면서 닌자님의 플래쉬 최근게시물을 수정하고 있습니다.
PHP 독학으로 공부중이라서 아무것도 모르겠어요.ㅠㅠ
날짜가 sitelink1에 05/1/5 이런식으로 정리되어 있어요.
그런데 이걸 정렬하니 10~19일이 먼저 나오고 1~9일 내용이 뒤로갑니다
$query = "SELECT $boards.* ,$boards_category.name AS category_name FROM $boards,$boards_category WHERE $boards.category=$boards_category.no and $boards.is_secret=0 $reg_limit2 ORDER BY $boards.sitelink1 LIMIT $list_num";
이걸 해결할 방법이 없을까요ㅠㅠ
$_zb_url = "http://^^/zboard/";
$_zb_path = "^^";
include $_zb_path."outlogin.php";
lpbox_flash("board", "sitelink1", "flash_bbs", "Title", "게시판이름","20", "40");
function lpbox_flash($ctype, $wsort, $skinname, $post_title,$board,$list_num,$max_len,$datetype="y/m/d"){
global $_zb_path, $_zb_url, $connect, $t_board, $admin_table;
$board_name = explode("|", $board);
$str = zReadFile($_zb_path."latest_skin/".$skinname."/main.html");
if(!$str) {
echo "지정하신 $skinname 이라는 최근목록 스킨이 존재하지 않습니다
";
return;
}
if(strlen($wsort)<=2){
$limit_date=(time()-($wsort*86400));
$reg_limit=" AND [board].sitelink1 >= '$limit_date'";
}else $whsort=explode("|",$wsort);
if(!$whsort[0]) $whsort[0]="sitelink1";
if(!$whsort[1]) $whsort[1]="DESC";
$whsort[1]=strtoupper($whsort[1]);
for ($i = 0; $i < sizeof($board_name); $i++){
$boards = "zetyx_board_".$board_name[$i];
$reg_limit2 = str_replace("[board]","$boards",$reg_limit);
if($ctype=="comment") $boards_category = "zetyx_board_comment_".$board_name[$i];
else $boards_category = "zetyx_board_category_".$board_name[$i];
if($ctype=="comment") $query = "SELECT * FROM $boards_category WHERE sitelink1>='$limit_date' ORDER BY sitelink1 DESC LIMIT $list_num";
else $query = "SELECT $boards.* ,$boards_category.name AS category_name FROM $boards,$boards_category WHERE $boards.category=$boards_category.no and $boards.is_secret=0 $reg_limit2 ORDER BY $boards.$whsort[0] $whsort[1] LIMIT $list_num";
$result = mysql_query($query);
while ($data_board = mysql_fetch_array($result)){
$bbs_tmp[] = $board_name[$i];
$subject[] = htmlspecialchars(stripslashes($data_board[subject]));
$name[] = htmlspecialchars(stripslashes($data_board[name]));
$sitelink1[] = htmlspecialchars(stripslashes($data_board[sitelink1]));
$category_name[] = htmlspecialchars(stripslashes($data_board[category_name]));
$comment[] = $data_board[total_comment];
$num[] = $data_board[no];
$sort_center[] = $data_board[$whsort[0]];
setlocale (LC_TIME,"ko");
$date1[] ="$data_board[sitelink1]";
$date2[] = date($datetype, $data_board[sitelink1]);
$memo[] = stripslashes($data_board[memo]);
$board_info = mysql_fetch_array(mysql_query("SELECT * FROM $admin_table WHERE name='$board_name[$i]'"));
$use_alllist[] = $board_info[use_alllist];
}
}
$date3 = $sort_center;
if($whsort[1]=="DESC") arsort($sort_center);
else asort($sort_center);
reset($sort_center);
list($header,$tmpStr)= explode("[loop]",$str);
list($loop,$footer) = explode("[/loop]",$tmpStr);
while(list($key,$value)=each($sort_center)){
$j++;
if($comment[$key]==0 || $ctype=="comment") $comments="";
else $comments="[".$comment[$key]."]";
if($use_alllist[$key]) $target = "zboard.php";
else $target = "zboard.php";
$subject[$key]=cut_str($subject[$key],$max_len);
$sitelink1[$key]=substr($sitelink1[$key],5,15);
$memo[$key]=cut_str($memo[$key],$max_len);
$main = str_replace("[name]","name$j=$name[$key]&",$loop);
$main = str_replace("[date]","date$j=$date2[$key]&",$main);
$main = str_replace("[table]","table$j=$bbs_tmp[$key]&",$main);
$main = str_replace("[sitelink1]","sitelink1$j=$sitelink1[$key]&",$main);
$main = str_replace("[category_name]","category_name$j=$category_name[$key]&",$main);
$main = str_replace("[comment]","comments$j=$comments&",$main);
$main = str_replace("[target]","target$j=$target&",$main);
if($date1[$key]>=(time()-86400)) $main = str_replace("[new]","new$j=1&",$main);
else $main = str_replace("[new]","",$main);
if($ctype=="comment") $main = str_replace("[subject]","subject$j=".$memo[$key]."&",$main);
else $main = str_replace("[subject]","subject$j=".$subject[$key]."&",$main);
$main_data .= $main."no$j=$num[$key]&";
if($co_num[$key])$main_data.="co_num$j=$co_num[$key]&";
if ($j>=$list_num) break;
}
$list = $header.$main_data.$footer;
$list = str_replace("[title]","title=$post_title&",$list);
$list=trim($list);
$list.="list_num=$list_num&_zb_url=".$_zb_url;
echo $list;
}
PHP 독학으로 공부중이라서 아무것도 모르겠어요.ㅠㅠ
날짜가 sitelink1에 05/1/5 이런식으로 정리되어 있어요.
그런데 이걸 정렬하니 10~19일이 먼저 나오고 1~9일 내용이 뒤로갑니다
$query = "SELECT $boards.* ,$boards_category.name AS category_name FROM $boards,$boards_category WHERE $boards.category=$boards_category.no and $boards.is_secret=0 $reg_limit2 ORDER BY $boards.sitelink1 LIMIT $list_num";
이걸 해결할 방법이 없을까요ㅠㅠ
$_zb_url = "http://^^/zboard/";
$_zb_path = "^^";
include $_zb_path."outlogin.php";
lpbox_flash("board", "sitelink1", "flash_bbs", "Title", "게시판이름","20", "40");
function lpbox_flash($ctype, $wsort, $skinname, $post_title,$board,$list_num,$max_len,$datetype="y/m/d"){
global $_zb_path, $_zb_url, $connect, $t_board, $admin_table;
$board_name = explode("|", $board);
$str = zReadFile($_zb_path."latest_skin/".$skinname."/main.html");
if(!$str) {
echo "지정하신 $skinname 이라는 최근목록 스킨이 존재하지 않습니다
";
return;
}
if(strlen($wsort)<=2){
$limit_date=(time()-($wsort*86400));
$reg_limit=" AND [board].sitelink1 >= '$limit_date'";
}else $whsort=explode("|",$wsort);
if(!$whsort[0]) $whsort[0]="sitelink1";
if(!$whsort[1]) $whsort[1]="DESC";
$whsort[1]=strtoupper($whsort[1]);
for ($i = 0; $i < sizeof($board_name); $i++){
$boards = "zetyx_board_".$board_name[$i];
$reg_limit2 = str_replace("[board]","$boards",$reg_limit);
if($ctype=="comment") $boards_category = "zetyx_board_comment_".$board_name[$i];
else $boards_category = "zetyx_board_category_".$board_name[$i];
if($ctype=="comment") $query = "SELECT * FROM $boards_category WHERE sitelink1>='$limit_date' ORDER BY sitelink1 DESC LIMIT $list_num";
else $query = "SELECT $boards.* ,$boards_category.name AS category_name FROM $boards,$boards_category WHERE $boards.category=$boards_category.no and $boards.is_secret=0 $reg_limit2 ORDER BY $boards.$whsort[0] $whsort[1] LIMIT $list_num";
$result = mysql_query($query);
while ($data_board = mysql_fetch_array($result)){
$bbs_tmp[] = $board_name[$i];
$subject[] = htmlspecialchars(stripslashes($data_board[subject]));
$name[] = htmlspecialchars(stripslashes($data_board[name]));
$sitelink1[] = htmlspecialchars(stripslashes($data_board[sitelink1]));
$category_name[] = htmlspecialchars(stripslashes($data_board[category_name]));
$comment[] = $data_board[total_comment];
$num[] = $data_board[no];
$sort_center[] = $data_board[$whsort[0]];
setlocale (LC_TIME,"ko");
$date1[] ="$data_board[sitelink1]";
$date2[] = date($datetype, $data_board[sitelink1]);
$memo[] = stripslashes($data_board[memo]);
$board_info = mysql_fetch_array(mysql_query("SELECT * FROM $admin_table WHERE name='$board_name[$i]'"));
$use_alllist[] = $board_info[use_alllist];
}
}
$date3 = $sort_center;
if($whsort[1]=="DESC") arsort($sort_center);
else asort($sort_center);
reset($sort_center);
list($header,$tmpStr)= explode("[loop]",$str);
list($loop,$footer) = explode("[/loop]",$tmpStr);
while(list($key,$value)=each($sort_center)){
$j++;
if($comment[$key]==0 || $ctype=="comment") $comments="";
else $comments="[".$comment[$key]."]";
if($use_alllist[$key]) $target = "zboard.php";
else $target = "zboard.php";
$subject[$key]=cut_str($subject[$key],$max_len);
$sitelink1[$key]=substr($sitelink1[$key],5,15);
$memo[$key]=cut_str($memo[$key],$max_len);
$main = str_replace("[name]","name$j=$name[$key]&",$loop);
$main = str_replace("[date]","date$j=$date2[$key]&",$main);
$main = str_replace("[table]","table$j=$bbs_tmp[$key]&",$main);
$main = str_replace("[sitelink1]","sitelink1$j=$sitelink1[$key]&",$main);
$main = str_replace("[category_name]","category_name$j=$category_name[$key]&",$main);
$main = str_replace("[comment]","comments$j=$comments&",$main);
$main = str_replace("[target]","target$j=$target&",$main);
if($date1[$key]>=(time()-86400)) $main = str_replace("[new]","new$j=1&",$main);
else $main = str_replace("[new]","",$main);
if($ctype=="comment") $main = str_replace("[subject]","subject$j=".$memo[$key]."&",$main);
else $main = str_replace("[subject]","subject$j=".$subject[$key]."&",$main);
$main_data .= $main."no$j=$num[$key]&";
if($co_num[$key])$main_data.="co_num$j=$co_num[$key]&";
if ($j>=$list_num) break;
}
$list = $header.$main_data.$footer;
$list = str_replace("[title]","title=$post_title&",$list);
$list=trim($list);
$list.="list_num=$list_num&_zb_url=".$_zb_url;
echo $list;
}