Skip to content

Instantly share code, notes, and snippets.

@tony1223
Created October 17, 2012 17:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tony1223/3907025 to your computer and use it in GitHub Desktop.
Save tony1223/3907025 to your computer and use it in GitHub Desktop.
public function view($articleID = null){
if($articleID == null){
show_404("Article not found !");
return true;
}
$this->load->model("ArticleModel");
//完成取資料動作
$article = $this->ArticleModel->get($articleID);
if($article == null){
show_404("Article not found !");
return true;
}
//更新文章計數
$this->ArticleModel->updateViews($articleID,$article->Views +1 );
$this->load->view('article_view',Array(
//設定網頁標題
"pageTitle" => "發文系統 - 文章 [".$article->Title."] ",
"article" => $article
));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment