<?php
/**
* @author moufer<moufer@163.com>
* @copyright www.modoer.com
* @version $Id index.php 1 2008-08-22 19:07 $
*/
define('SCRIPTNAV', 'article');
require_once './include/inc_common.php';
!defined('IN_MUDDER') && exit('Access Denied');

$articles = $where = array();
$where[] = "status='1'";
$classid = intval($classid);
$classid > 0 && $where[] = "classid='$classid'";
$where = implode(' AND ', $where);
$total = $db->get_value("SELECT COUNT(*) FROM {$dbpre}articles WHERE $where");
if($total > 0) {
    $orderlist = array(
        'dateline' => 'dateline DESC',    
        'pageview' => 'pageview DESC',
        'digg' => 'digg DESC',
    );
    $order = empty($order) || empty($orderlist[$order]) ? 'dateline' : $order;
    $orderby = $orderlist[$order];
    $multiurl = 'index.php?classid='.$classid.'&order='.$order;
    $offset = 5;
    $multipage = multi($total, $offset, $page, $multiurl);
    $limit = get_limit($page, $offset);
    $query = $db->query("SELECT * FROM {$dbpre}articles WHERE $where ORDER BY $orderby LIMIT $limit");
    while($row = $db->fetch_array($query)) {
        $row['classname'] = $articleclass[$row['classid']]['classname'];
        $articles[] = $row;
    }
    $db->free_result($query);
}

$orderlist = array(
    'dateline' => '发表时间',
    'pageview' => '浏览量',
    'digg' => '顶一下',
);

$subtitle = '新闻资讯';
require_once MUDDER_ROOT.'header.php';
require_once template(MOD_FLAG.'_index');
footer();
?>