/**
* 获取广告位广告列表
*/
function get_ad($position_id = 0)
{
$sql = "SELECT ad_id, position_id, ad_name, ad_link, ad_thumb, ad_mthumb, spcdesc, sortnumber " .
"FROM " . $GLOBALS['ecs']->table('ad') . " " .
"WHERE position_id = " . intval($position_id) . " AND is_show = 1 " .
"ORDER BY sortnumber ASC, ad_id DESC";
$res = $GLOBALS['db']->getAll($sql);
$arr = array();
if ($res)
{
foreach ($res as $key => $row)
{
$arr[$key]['ad_id'] = $row['ad_id'];
$arr[$key]['ad_name'] = $row['ad_name'];
$arr[$key]['ad_link'] = $row['ad_link'];
$arr[$key]['thumb'] = $row['ad_thumb'];
$arr[$key]['spcdesc'] = $row['spcdesc'];
}
}
return $arr;
}
/**
* 获取文章分类信息
*/
function get_article_cat($cat_id = 0)
{
$sql = "SELECT cat_id, cat_name, cat_name_other, jump_url, cat_spcdesc, cat_thumb, define_url " .
"FROM " . $GLOBALS['ecs']->table('article_cat') . " " .
"WHERE cat_id = " . intval($cat_id) . " LIMIT 1";
$row = $GLOBALS['db']->getRow($sql);
if ($row)
{
$arr = array(
'cat_id' => $row['cat_id'],
'cat_name' => $row['cat_name'],
'cat_name_other' => $row['cat_name_other'],
'url' => $row['jump_url'] ? $row['jump_url'] : $row['define_url'],
'cat_spcdesc' => $row['cat_spcdesc'],
'cat_thumb' => $row['cat_thumb'],
);
}
else
{
$arr = array();
}
return $arr;
}
/**
* 获取单篇文章信息
*/
function get_article($article_id = 0)
{
$sql = "SELECT article_id, cat_id, title, article_thumb, spcdesc, other, keywords " .
"FROM " . $GLOBALS['ecs']->table('article') . " " .
"WHERE article_id = " . intval($article_id) . " AND is_show = 1 LIMIT 1";
$row = $GLOBALS['db']->getRow($sql);
if ($row)
{
$arr = array(
'article_id' => $row['article_id'],
'cat_id' => $row['cat_id'],
'title' => $row['title'],
'thumb' => $row['article_thumb'],
'spcdesc' => $row['spcdesc'],
'other' => $row['other'],
'keywords' => $row['keywords'],
);
}
else
{
$arr = array();
}
return $arr;
}
/**
* 获取分类下的文章列表(含子分类)
*/
function get_cat_article_list($cat_id = 0, $limit = 20)
{
$cat_id = intval($cat_id);
$children = get_children($cat_id);
$cat_ids = array($cat_id);
if ($children)
{
foreach ($children as $child)
{
$cat_ids[] = $child['cat_id'];
}
}
$cat_ids_str = implode(',', $cat_ids);
$sql = "SELECT article_id, cat_id, title, article_thumb, spcdesc, add_time, other, keywords, link " .
"FROM " . $GLOBALS['ecs']->table('article') . " " .
"WHERE cat_id IN (" . $cat_ids_str . ") AND is_show = 1 " .
"ORDER BY add_time DESC, article_id DESC LIMIT " . intval($limit);
$res = $GLOBALS['db']->getAll($sql);
$arr = array();
if ($res)
{
foreach ($res as $key => $row)
{
$arr[$key]['article_id'] = $row['article_id'];
$arr[$key]['cat_id'] = $row['cat_id'];
$arr[$key]['title'] = $row['title'];
$arr[$key]['thumb'] = $row['article_thumb'];
$arr[$key]['spcdesc'] = $row['spcdesc'];
$arr[$key]['other'] = $row['other'];
$arr[$key]['add_time'] = $row['add_time'];
$arr[$key]['url'] = $row['link'] ? $row['link'] : build_uri('article', array('aid' => $row['article_id'], 'cat_id' => $row['cat_id']));
if ($row['add_time'])
{
$arr[$key]['add_time_d'] = date('d', $row['add_time']);
$arr[$key]['add_time_ym'] = date('Y/m', $row['add_time']);
}
else
{
$arr[$key]['add_time_d'] = '';
$arr[$key]['add_time_ym'] = '';
}
}
}
return $arr;
}
/**
* 获取相对分类列表(含子分类及文章)
*/
function get_relative_cat_list($cat_id = 0)
{
$cat_id = intval($cat_id);
$sql = "SELECT cat_id, cat_name, jump_url " .
"FROM " . $GLOBALS['ecs']->table('article_cat') . " " .
"WHERE parent_id = " . $cat_id . " " .
"ORDER BY sort_order ASC, cat_id ASC";
$children = $GLOBALS['db']->getAll($sql);
$arr = array();
if ($children)
{
foreach ($children as $key => $child)
{
$arr[$key]['cat_id'] = $child['cat_id'];
$arr[$key]['cat_name'] = $child['cat_name'];
$arr[$key]['url'] = $child['jump_url'] ? $child['jump_url'] : '';
$arr[$key]['article_list'] = get_cat_article_list($child['cat_id'], 5);
$sql2 = "SELECT cat_id, cat_name, jump_url " .
"FROM " . $GLOBALS['ecs']->table('article_cat') . " " .
"WHERE parent_id = " . $child['cat_id'] . " " .
"ORDER BY sort_order ASC, cat_id ASC";
$arr[$key]['article_cat_list'] = $GLOBALS['db']->getAll($sql2);
}
}
return $arr;
}
?>
Warning: Cannot modify header information - headers already sent by (output started at /www/wwwroot/jcyyzx.com/includes/lib_common.php:1494) in /www/wwwroot/jcyyzx.com/includes/cls_session.php on line 82
Warning: Cannot modify header information - headers already sent by (output started at /www/wwwroot/jcyyzx.com/includes/lib_common.php:1494) in /www/wwwroot/jcyyzx.com/includes/cls_session.php on line 116
Warning: Cannot modify header information - headers already sent by (output started at /www/wwwroot/jcyyzx.com/includes/lib_common.php:1494) in /www/wwwroot/jcyyzx.com/includes/init.php on line 158
Warning: Cannot modify header information - headers already sent by (output started at /www/wwwroot/jcyyzx.com/includes/lib_common.php:1494) in /www/wwwroot/jcyyzx.com/includes/init.php on line 159
Warning: Cannot modify header information - headers already sent by (output started at /www/wwwroot/jcyyzx.com/includes/lib_common.php:1494) in /www/wwwroot/jcyyzx.com/includes/cls_template.php on line 47
Fatal error: Uncaught Error: Call to undefined function get_article() in /www/wwwroot/jcyyzx.com/article.php:43
Stack trace:
#0 {main}
thrown in /www/wwwroot/jcyyzx.com/article.php on line 43