コード例 #1
0
ファイル: Content.class.php プロジェクト: jyht/v5
 public function find($aid)
 {
     $ContentModel = ContentViewModel::getInstance($this->_mid);
     $data = $ContentModel->where($ContentModel->tableFull . '.aid=' . $aid)->find();
     if (!$data) {
         $this->error = '文章不存在';
         return false;
     }
     $ContentOutModel = new ContentOutModel($this->_mid);
     $data = $ContentOutModel->get($data);
     if ($data == false) {
         $this->error = $ContentOutModel->error;
     } else {
         return $data;
     }
 }
コード例 #2
0
ファイル: Content.class.php プロジェクト: jyht/v5
 public function find($aid)
 {
     $ContentModel = ContentViewModel::getInstance($this->_mid);
     $data = $ContentModel->where($ContentModel->tableFull . '.aid=' . $aid)->find();
     if (!$data) {
         $this->error = '文章不存在';
         return false;
     }
     $ContentOutModel = new ContentOutModel($this->_mid);
     $data = $ContentOutModel->get($data);
     if ($data == false) {
         $this->error = $ContentOutModel->error;
     } else {
         $data['time'] = date("Y/m/d", $data['addtime']);
         $data['caturl'] = Url::getCategoryUrl($data);
         //模板文件
         $template = empty($data['template']) ? $data['arc_tpl'] : $data['template'];
         $data['template'] = 'template/' . C('web_style') . '/' . $template;
         //是否为静态
         $data['iscontenthtml'] = $data['url_type'] == 1 || $data['url_type'] == 3 && $data['arc_url_type'] == 1;
         //静态文件
         $htmlDir = C("HTML_PATH") ? C("HTML_PATH") . '/' : '';
         $time = getdate($data['addtime']);
         if (!empty($data['html_path'])) {
             //单独设置
             $data['htmlfile'] = $htmlDir . $data['html_path'];
         } else {
             //使用栏目定义
             $data['htmlfile'] = $htmlDir . str_replace(array('{catdir}', '{y}', '{m}', '{d}', '{cid}', '{aid}', '{timestamp}'), array($data['catdir'], $time['year'], $time['mon'], $time['mday'], $data['cid'], $data['aid'], $data['addtime']), $data['arc_html_url']);
         }
         //用户头像数据
         if (empty($data['icon'])) {
             $data['icon'] = __ROOT__ . '/data/image/user/250.png';
         } else {
             $data['icon'] = __ROOT__ . '/' . $data['icon'];
         }
         return $data;
     }
 }