<?php
define('IN_OUN', true); 
include_once( "./includes/command.php");
include_once( ROOT_PATH."includes/item_set.php");
include_once( ROOT_PATH."ads.php");
/* 产品页显示的模块 */   
$Aconf['header_title'] = $Aweb_url['votes'][0]."|".$Aconf["web_title"];
/* 调查列表 查询条件 */
$db_table = $pre."vote_title";
$where = "a.states=0 AND a.is_show = 1 AND a.domain_id = ".$_SESSION[$un_domain_id];
$sql = "SELECT COUNT(*) as count FROM ".$db_table." AS a WHERE 1 AND ". $where;
$row = $oPub->getRow($sql);
$filter['record_count'] = $row[count];
unset($row);
$page = new ShowPage;
$Aconf['set_pagenum'] = 30;
$page->PageSize = $Aconf['set_pagenum'];
$page->Total = $filter['record_count'];
$pagenew = $page->PageNum();
$page->LinkAry = array(); 
$strOffSet = $page->OffSet();
/* 翻页 */
$Ahome["showpage"] = ($filter['record_count']  > $Aconf['set_pagenum'])?$page->ShowLink_num():''; 

$sql = "SELECT a.vtid,a.vt_name,a.vt_desc,a.vt_nums,a.add_time 
       FROM ".$pre."vote_title as a 
		WHERE  $where 
        ORDER BY a.add_time DESC   
	    LIMIT ". $strOffSet;
$row = $oPub->select($sql);
if($row )
{ 
	foreach ($row AS $key=>$val)
	{ 
		$row[$key]['add_time']  = ($val['add_time'])?date("y年m月d日", $val['add_time']):''; 
		if($Aconf['rewrite']){ 
			$row[$key]['vote_url'] = 'vote-'.$val[vtid].'-0.html';
		}else{
			$row[$key]['vote_url'] = 'vote.php?id='.$val[vtid];
		} 

	}

}
$Ahome["votes"] = $row;unset($row);
$Ahome["nowNave"]  = '<A HREF="./">首页</A> > '.$Aweb_url['votes'][0];  


//右侧 时尚调用 end     
if ((DEBUG_MODE & 2) != 2) {
    $smarty->caching = true;
}

$strCache_id = $_SESSION[$un_domain_id].$_REQUEST[page]; 
$cache_id = sprintf('%X', crc32($str_cache_id));
if (!$smarty->is_cached($Aconf["displayFile"], $cache_id)) {
    assign_template($Aconf); 
    $smarty->assign('home', $Ahome ); 
    $smarty->assign('user_info', $_SESSION );
    unset($Ahome);
    /* 页面中的动态内容 */
    assign_dynamic(str_replace('.html','',$str_templates));
}
$smarty->display($Aconf["displayFile"], $cache_id); 
?>
