public function article($id, $page = 1, $tpl = true) { $article = iDB::row("SELECT * FROM `#iCMS@__article` WHERE id='" . (int) $id . "' AND `status` ='1' LIMIT 1;", ARRAY_A); $article or iPHP::throw404('运行出错!找不到文章: <b>ID:' . $id . '</b>', 10001); if ($article['url']) { if (iPHP::$iTPL_MODE == "html") { return false; } else { $this->API_hits($id); iPHP::gotourl($article['url']); } } if (iCMS_ARTICLE_DATA === "TEXT") { iPHP::app('article.table'); $article_data = articleTable::get_text($id); } else { $article && ($article_data = iDB::row("SELECT body,subtitle FROM `#iCMS@__article_data` WHERE aid='" . (int) $id . "' LIMIT 1;", ARRAY_A)); } $vars = array('tags' => true, 'user' => true, 'meta' => true, 'prev_next' => true, 'category_lite' => false); $article = $this->value($article, $article_data, $vars, $page, $tpl); unset($article_data); if ($article === false) { return false; } if ($tpl) { iCMS::hooks('enable_comment', true); $article_tpl = empty($article['tpl']) ? $article['category']['contentTPL'] : $article['tpl']; strstr($tpl, '.htm') && ($article_tpl = $tpl); iPHP::assign('category', $article['category']); unset($article['category']); iPHP::assign('article', $article); $html = iPHP::view($article_tpl, 'article'); if (iPHP::$iTPL_MODE == "html") { return array($html, $article); } } else { return $article; } }