/** * Index Page, for now just render all static content. */ public function actionIndex() { //TODO add cache logic later. //load last 5 news $criteria = new CDbCriteria(); $criteria->limit = 5; $criteria->order = 'n_id DESC'; $news = News::model()->findAll($criteria); //load last 9 suggestion images $criteria = new CDbCriteria(); $criteria->limit = 9; $criteria->order = 'id DESC'; $criteria->condition = 'is_recommend = 1'; $images = GalleryImage::model()->findAll($criteria); $this->render('index', array('news' => $news, 'posts' => BlogPosts::post(), 'notices' => BlogPosts::notice(), 'images' => $images)); }
public function actionIndex() { /* $content = file_get_contents('http://blog.go9999.com/feed/'); // <title></title> <link></link> preg_match_all('/<title>([^<]*)<\/title>[^<]*<link>([^<]*)<\/link>/i', $content, $out); //print_r($out); $blogPosts = array(); foreach($out[1] as $key => $value) { $blogPost[] = array( 'title' => $value, 'link' => $out[1][$key] ); } echo "<pre>"; print_r($blogPost); */ echo "<pre>"; echo 'post'; print_r(BlogPosts::post()); echo 'notice'; print_r(BlogPosts::notice()); }