init(); $db_obj->table("file"); $db_obj->column("*,to_char(cast(substr(open_date,1,8) as date), 'YYYY/MM/DD') as date"); $db_obj->order("open_date","desc"); $db_obj->order("id","desc"); $newlist = $db_obj->select(); //$newlist = get_file( $db, $memcache ); $newlist = view_check($newlist); $newlist = date_check($newlist); $newlist = hash_limit($newlist, 10, 0); $assign['newlist'] = $newlist; unset($newlist); // ranking $ranking = $db_obj->select(); ///$ranking = get_file( $db, $memcache ); $ranking = view_check($ranking); $ranking = date_check($ranking); $date = date("YmdHis", time()-(86400*14)); /*for( $i = 0; $i < count($ranking); $i++ ){ if( $ranking[$i]['open_date'] > $date ){ $tmp[$i] = $memcache->get('count_'.$ranking[$i]['id']); } } if( count($tmp) > 0){ arsort($tmp, SORT_NUMERIC); foreach( $tmp as $key=>$data ){ $ranking[$key]['count'] = $memcache->get('count_'.$ranking[$key]['id']); $tmp2[] = $ranking[$key]; if( count($tmp2) >= 10 ) break; } $assign['ranking'] = $tmp2; unset($tmp); unset($tmp2); }else{ $assign['ranking'] = ""; }*/ if( is_file(BASE_DIR."/page/".$page.".php") ) require BASE_DIR."/page/".$page.".php"; elseif( is_file(BASE_DIR."/templates/".$page.".tmpl") ){ $mtime = filemtime( BASE_DIR."/templates/".$page.".tmpl" ); $timestamp = date("YmdHis", $mtime); get_lastmodified($timestamp); } // next if($cnt_total > $cnt_limit){ $assign['next'] = true; $next_url['offset'] = "offset=".($offset+$limit); } // prev if( ($offset-$limit) >= 0 ){ $assign['prev'] = true; } if( ($offset-$limit) > 0 ){ $prev_url['offset'] = "offset=".($offset-$limit); } if( !empty($prev_url) ){ $assign['prev_url'] = "?".implode('&', $prev_url); } if( !empty($next_url) ){ $assign['next_url'] = "?".implode('&', $next_url); } $assign['contents'] = $contents; $assign['page'] = $page; if( is_array($assign) ){ $tmpl->assign($assign); } $tmpl->display($page); //$memcache->close(); $db->destroy(); exit; ?>