コード例 #1
0
 /**
  * This is the default 'index' action that is invoked
  * when an action is not explicitly requested by users.
  */
 public function actionIndex()
 {
     $tag1 = '[SHOWCASE]';
     $showCaseList = ImageCatalogue::model()->findAllByAttributes(array('tag1' => $tag1));
     /*array(
                       array($modelImage->url, $modelImage->caption),
                       array('images/banner/02.jpg', 'Text 2'),
                       array('images/banner/03.jpg', 'Text 3'),
                       array('images/banner/04.jpg', 'Text 2'),
                       array('images/banner/05.jpg', 'Text 3'),
                 )$product['prodname']
       * array("/img/slider/flickr/s10.jpg", "/img/slider/flickr/s11.jpg");
       */
     $i = 0;
     $result = array();
     foreach ($showCaseList as $record) {
         $result[$i] = $record;
         $i++;
     }
     // renders the view file 'protected/views/site/index.php'
     // using the default layout 'protected/views/layouts/main.php'
     $this->render('index', array('showCaseList' => $result));
 }
コード例 #2
0
 /**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  * @param integer $id the ID of the model to be loaded
  * @return ImageCatalogue the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = ImageCatalogue::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }