$smarty->assign('best_goods', get_recommend_goods('best')); // 推荐商品 $smarty->assign('new_goods', get_recommend_goods('new')); // 最新商品 $smarty->assign('hot_goods', get_recommend_goods('hot')); // 热点文章 $smarty->assign('promotion_goods', get_promote_goods()); // 特价商品 $smarty->assign('related_goods', article_related_goods($_REQUEST['id'])); // 特价商品 $smarty->assign('id', $article_id); $smarty->assign('username', $_SESSION['user_name']); $smarty->assign('email', $_SESSION['email']); $smarty->assign('type', '1'); $smarty->assign('promotion_info', get_promotion_info()); $smarty->assign('top_art_cat_id', get_top_art_cat_id($article['cat_id'])); //888 $smarty->assign('artciles_list', get_cat_articles(12, 1, 5, '')); /* 验证码相关设置 */ if (intval($_CFG['captcha']) & CAPTCHA_COMMENT && gd_version() > 0) { $smarty->assign('enabled_captcha', 1); $smarty->assign('rand', mt_rand()); } $smarty->assign('article', $article); $smarty->assign('keywords', htmlspecialchars($article['keywords'])); $smarty->assign('description', htmlspecialchars($article['description'])); $catlist = array(); foreach (get_article_parent_cats($article['cat_id']) as $k => $v) { $catlist[] = $v['cat_id']; } assign_template('a', $catlist);
function get_top_art_cat_id($nid) { $sql = "select parent_id from " . $GLOBALS['ecs']->table('article_cat') . " where cat_id = " . $nid . ""; $temp_id = 0; $pid = $GLOBALS['db']->getOne($sql); if ($pid > 0) { $temp_id = get_top_art_cat_id($pid); } else { $temp_id = $nid; } return $temp_id; }