コード例 #1
0
 public function actionIndex($typeId)
 {
     $this->pageTitle = "新闻分类";
     //查询该分类下所有新闻
     $newsInfo = NewsArticles::model()->findAll("typeId={$typeId}");
     //查询该分类的详细信息
     $newsType = NewsTypes::model()->findByPk($typeId);
     if ($newsInfo == NULL) {
         $this->redirect(__APP__ . "/success/index/act/nocontent");
     }
     $data = array("newsInfo" => $newsInfo, "newsType" => $newsType);
     $this->render("index", $data);
 }
コード例 #2
0
ファイル: BaseController.php プロジェクト: denson7/phpstudy
 public function init()
 {
     //查询所有分类(导航菜单用)
     $this->newsTypes = NewsTypes::model()->findAll();
 }