Пример #1
0
 public function init()
 {
     //获取菜单栏 && 获取当前路由相关信息
     $common = new \Admin\Model\commonModel();
     $this->common = $common;
     $menuData = $common->getMenu();
     $navArray = $common->navArray;
     $routeInfo = $common->getRouteInfo();
     //获取网站填写的前台设置
     $config = new \Admin\Model\webConfigModel();
     $webConfig = $config->getConfig();
     $tplData = array('menuData' => $menuData, 'routeInfo' => $routeInfo, 'navArray' => $navArray, 'webConfig' => $webConfig);
     $this->getView()->assign($tplData);
 }
Пример #2
0
 /**
  * 初始化 菜单信息 路由信息  网站设置 侧边栏模块
  */
 function __construct()
 {
     //获取菜单
     //获取菜单栏 && 获取当前路由相关信息
     $common = new \Home\Model\menuModel();
     $this->common = $common;
     $menuData = $common->getNav();
     $routeInfo = $common->getRouteInfo();
     //获取网站填写的前台设置
     $config = new \Admin\Model\webConfigModel();
     $webConfig = $config->getConfig();
     $templatesPath = WEB_TEMP_PATH . "/" . C("view_templates");
     //获取侧边栏信息
     $sidebarModel = new \Home\Model\sidebarModel();
     $sidebar = $sidebarModel->getSidebarData();
     //载入
     $tplData = array('menuData' => $menuData, 'routeInfo' => $routeInfo, 'webConfig' => $webConfig, 'templatesPath' => $templatesPath, 'sidebarSystem' => $sidebar['system'], 'sidebarDiy' => $sidebar['diy']);
     //var_dump( $sidebar['system']);exit;
     $this->getView()->assign($tplData);
 }
Пример #3
0
 /**
  * 显示博文
  */
 public function showAction()
 {
     $id = get("id", "int");
     $where['status'] = \Admin\Article\Type\Status::STATUS_ENABLE;
     $where['member_id'] = 1;
     $where['id'] = $id;
     $row = db()->Table('article')->getRow($where)->limit(0, 1)->done();
     if (!empty($row['password'])) {
         $cookiePassword = addslashes(trim(cookie('xtt_logpwd_' . $row['id'])));
         if ($cookiePassword != $row['password']) {
             $this->getView()->assign(array('id' => $id, 'msg' => ""));
             return $this->getView()->display("checkpwd");
         }
     }
     $config = new \Admin\Model\webConfigModel();
     $webConfig = $config->getConfig();
     if ($webConfig['ischkcomment']) {
         new \Common\Security\CommentVerSession();
     }
     $model = new \Home\Model\homeModel();
     $row['category'] = $model->getArticleCategory($row['category']);
     $tag = new \Admin\Model\articleModel();
     //获取该文章标签
     $tags = $tag->getTags($row['id'], true);
     if ($tags) {
         $row['tags'] = explode(",", $tags);
     }
     $row['author'] = member($row['member_id']);
     $row['content'] = stripslashes($row['content']);
     //加载评论
     $commentWhere['status'] = \Admin\Comment\Type\Status::STATUS_ENABLE;
     $commentWhere['type'] = \Admin\Comment\Type\Type::TYPE_ARTICLE;
     $commentWhere['data'] = $id;
     $comments = db()->Table('comment')->getAll($commentWhere)->order("id " . $webConfig['comment_order'])->done();
     //生成序列树
     $comments = $this->sortOut($comments);
     $this->getView()->assign(array('blog' => $row, "comments" => $comments));
     return $this->getView()->display();
 }