bnbweb/news.php

57 lines
2.0 KiB
PHP
Raw Permalink Normal View History

2022-11-14 15:49:28 +00:00
<?php
define('IN_ECS', true);
require(dirname(__FILE__) . '/includes/init.php');
/* 載入語言文件 */
//require_once(ROOT_PATH . 'languages/' .$_CFG['lang']. '/news.php');
/*------------------------------------------------------ */
//-- act 操作项的初始化
/*------------------------------------------------------ */
if (empty($_REQUEST['act']))
{
$_REQUEST['act'] = 'view';
}
/*------------------------------------------------------ */
//-- PROCESSOR
/*------------------------------------------------------ */
if ($_REQUEST['act'] == 'list')
{
assign_template();
// assign_dynamic('news');
$sql = "SELECT * " .
" FROM " . $GLOBALS['ecs']->table('hs_news') .
" WHERE enable=1 and (start_time<='".date("Y-m-d")."' and end_time>='".date("Y-m-d")."') and hs_id= ".$site_id;
$news_list = $GLOBALS['db']->getAll($sql);
$site_name=$GLOBALS['db']->getOne("SELECT cname FROM ".$GLOBALS['ecs']->table('hs_web')." WHERE hs_id=".$site_id);
$smarty->assign('title',$site_name."-優惠新訊");
$smarty->assign('news_list',$news_list);
$smarty->display('news.html');
}
/*------------------------------------------------------ */
//-- 拍卖商品 --> 出价
/*------------------------------------------------------ */
elseif ($_REQUEST['act'] == 'view')
{
assign_template();
assign_dynamic('news');
//$position = assign_ur_here(0, $_LANG['shopping_activity']);
//$smarty->assign('page_title', $position['title']); // 页面标题
//$smarty->assign('ur_here', $position['ur_here']); // 当前位置
$sql = 'SELECT * ' .
' FROM ' . $GLOBALS['ecs']->table('hs_news') .
' WHERE id= '.$_REQUEST['id'].
' LIMIT 1';
$news = $GLOBALS['db']->getRow($sql);
$site_name=$GLOBALS['db']->getOne("SELECT cname FROM ".$GLOBALS['ecs']->table('hs_web')." WHERE hs_id=".$site_id);
$smarty->assign('title',$site_name."-優惠新訊-".$news['subject']);
$smarty->assign('news',$news);
$smarty->display('in_news.html');
}