<?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'";
$shopid > 0 && $where[] = "shopid='$shopid'";
$where = implode(' AND ', $where);
$total = $db->get_value("SELECT COUNT(*) FROM {$dbpre}articles WHERE $where");
$offset = 10;
$limit = get_limit($page, $offset);
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 = 'list.php?type='.$type.'&shopid='.$shopid.'&order='.$order;
    $multipage = multi($total, $offset, $page, $multiurl);
    $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);
}

if($shopid > 0) {
    if(!function_exists('getItem')) {
        require_once(MUDDER_ROOT.'./'.$_modules['shop']['directory'].'/include/fun_item.php');
    }
    $item = getItem($shopid);
}


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

$subtitle = '新闻资讯'.($item ? '_'.$item['fullname'] : '');
require_once MUDDER_ROOT.'header.php';
require_once template('article_list');
footer();
?>