| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- <?php
- // +----------------------------------------------------------------------
- // | ThinkCMF [ WE CAN DO IT MORE SIMPLE ]
- // +----------------------------------------------------------------------
- // | Copyright (c) 2013-2014 http://www.thinkcmf.com All rights reserved.
- // +----------------------------------------------------------------------
- // | Author: Dean <zxxjjforever@163.com>
- // +----------------------------------------------------------------------
- namespace app\appapi\controller;
- use cmf\controller\HomeBaseController;
- use think\facade\Db;
- use think\db\Query;
- class PageController extends HomebaseController{
-
- //文章
- public function news() {
- $id = $this->request->param('id',0,'intval');
- $news=Db::name("posts")
- ->field("post_title,post_content,post_title_en")
- ->where("id='{$id}'")->find();
- $language=cmf_current_lang();
- if($language=='en'){
- $news['post_title']=$news['post_title_en'];
- }
- $this->assign("news",$news);
- $this->assign('id',$id);
- return $this->fetch();
- }
- //读取常见问题下的文章列表
- public function questions(){
- $questionList=Db::name("posts")
- ->field("id,post_title,post_title_en")
- ->where("termid=13")
- ->select()
- ->toArray();
- //$questionList->all();
- $language=cmf_current_lang();
- foreach($questionList as $k=>$v){
- if($language=='en'){
- $questionList[$k]['post_title']=$v['post_title_en'];
- }
- }
-
- $time=time();
- $this->assign("questionList",$questionList);
- $this->assign("time",$time);
- return $this->fetch();
- }
-
- }
|