/**
  * Finds the Papka model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Papka the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Papka::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
예제 #2
0
<?php

use yii\helpers\Html;
use yii\widgets\ActiveForm;
use backend\models\Papka;
/* @var $this yii\web\View */
/* @var $model backend\models\Pages */
/* @var $form yii\widgets\ActiveForm */
//echo var_dump($m);
$papki = Papka::find()->all();
$namepap = Papka::findOne($model->id_papka);
$p = '';
foreach ($papki as $m) {
    if ($m->title) {
        $p .= '<option value="' . $m->id . '">' . $m->title . '</option>';
    }
}
?>

<div class="pages-form">

    <?php 
$form = ActiveForm::begin();
?>

    <div class="form-group field-pages-status">
        <label for="pages-status" class="control-label">Раздел</label>
        <select name="Pages[id_papka]" class="form-control" id="pages-status">
            <option class="in" value=" <?php 
echo $namepap['id'];
?>