Пример #1
0
 /**
  * Finds the commentary model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return commentary the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = commentary::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Пример #2
0
			<h1><?php 
echo Html::encode($this->title);
?>
</h1>
			<h4><?php 
echo "author: {$model->author_id}     Date: {$model->publish_date}";
?>
</br></h4>
			<?php 
echo DetailView::widget(['model' => $model, 'template' => "{value}", 'attributes' => ['content:ntext']]);
?>
	
		</div>
		
		<div style="width:60%">
		</br>
					<?php 
echo Html::a('New Commentary', ['com/create', 'idpost' => $model->id], ['class' => 'btn btn-primary']);
?>
			<h3>Commentary:</h3>
			<?php 
$dataProvider = new ActiveDataProvider(['query' => commentary::find()->where(['postid' => $model->id]), 'pagination' => ['pageSize' => conf::$numbercomperpage], 'sort' => ['defaultOrder' => ['data' => SORT_DESK]]]);
echo ListView::widget(['dataProvider' => $dataProvider, 'itemView' => '_com']);
?>
			</br>

		</div>
	</div>
</center>