示例#1
0
文件: blog.php 项目: ygres/sblog
 function index()
 {
     system::setParam("page", "post");
     if ($this->args[0] != "blog") {
         $cacheID = $this->args[0] . "|POST";
         $this->smarty->setCacheID($cacheID);
         if (isset($_POST["SLUG"]) && isset($_POST["comment"])) {
             blog::addCommentBySLUG($_POST["SLUG"]);
         }
         if (!$this->smarty->isCached()) {
             $sqlData = blog::getOnePost($this->args[0])->fetchAll();
             if ($sqlData) {
                 $sqlData = array_shift($sqlData);
                 $comments = comments::get($sqlData["contentID"]);
                 $this->smarty->assign("comments", $comments);
                 blog::highlightCode($sqlData["body"]);
                 $this->smarty->assign("item", $sqlData);
             }
         }
     } else {
         system::redirect("/");
     }
 }