include("../include/mysql_func.php");
include("../include/comm_func.php");
include("../include/constants.php");
?>
//print_r($_POST);
//phpinfo();
$title = "newstarnet index page";
$conn = connect_database($NEWS_DB);
$settings = get_query_row($conn, "select * from layout_setting" );
$col_per_row = 5;
$table_name = "news_website_categories";
$sql = "select * from $table_name where status=1 order by news_cat_order";
$special_topic_list = get_query_list($conn, $sql);
if( !empty($_REQUEST[id]) ) $id = $_REQUEST[id];
if( !empty($_POST[id]) ) $id = $_POST[id];
if( empty($id) ) $id = 0;
/****************************************
* handle page number & size *
****************************************/
$where = " where news_website_cat_id=$id and news_art_status=4 ";
$total_page = 0;
if( !empty($_POST["page_size"]) ) $page_size = $_POST["page_size"];
if( ($_POST["action"]=="pagesize") && !empty($_POST["p_size"]) ) $page_size = $_POST["p_size"];
$total_rows = get_a_value($conn, "select count(*) from $NEWS_ARTICLES_TABLE $where");
if( $page_size > $total_rows ) $page_size = $total_rows;
if( empty($page_size) || ($page_size < 1) ) $page_size = $ARTICLES_PER_PAGE;
if( empty($current_page) ) $current_page = 1;
if($_POST["action"]=="lastpage") $current_page--;
if($_POST["action"]=="nextpage") $current_page++;
if($_POST["action"]=="gopage") $current_page = $_POST["gopage"];
$total_page = ($total_rows - $total_rows % $page_size) / $page_size;
if($total_rows % $page_size > 0) $total_page++;
if(sizeof($news_list) % $page_size) $total_page++;
if($current_page < 1) $current_page = 1;
if($current_page > $total_page) $current_page = $total_page;
$submit_to = "news_web_category.php";
$page_contral_bgcolor="#f4f7fb";
$start_row = ($current_page - 1) * $page_size;
if( !empty($id) )
{
// $sql = "select * from $NEWS_ARTICLES_TABLE $where order by news_art_post_time desc" . " LIMIT $start_row, $page_size";
$sql = "select * from $NEWS_ARTICLES_TABLE $where order by news_art_id desc" . " LIMIT $start_row, $page_size";
$news_list = get_query_list($conn, $sql);
$column = get_query_row($conn, "select * from $table_name where news_cat_id=" . $id);
$column[news_cat_title] = "-->" . $column[news_cat_title];
}
?>
include("header.php"); ?>
include("ad.php"); ?>
if( sizeof($special_topic_list) % $col_per_row > 0 ) $j = ( (sizeof($special_topic_list) - sizeof($special_topic_list) % $col_per_row) / $col_per_row + 1) * $col_per_row;
else $j = sizeof($special_topic_list);
$i=0;
for( $i=0; $i<$j; $i++ )
{
if( $i % $col_per_row == 0 ) echo "";
?>
= $special_topic_list[$i][news_cat_title] ?> |
if( ($i+1) % $col_per_row == 0 ) echo " ";
} ?>
if( sizeof($news_list)>0 ) include("../include/news_list_control_front_end.php"); ?>
|
include("menu.php"); ?>
// include("ad.php"); ?>
include("footer.php"); ?>