<?php use yii\helpers\Html; use source\core\lib\Common; use source\LuLu; use source\modules\taxonomy\models\TaxonomyCategory; /* @var $this yii\web\View */ /* @var $model app\models\Taxonomy */ $category = LuLu::getGetValue('category'); $this->title = '新建分类项'; $category = LuLu::getGetValue('category'); $categoryModel = TaxonomyCategory::findOne(['id' => $category]); $this->addBreadcrumbs([['分类管理', ['/taxonomy']], [$categoryModel['name'], ['/taxonomy/taxonomy', 'category' => $category]], $this->title]); ?> <div class="taxonomy-create"> <?php echo $this->render('_form', ['model' => $model, 'category' => $category]); ?> </div>
/** * Finds the TaxonomyCategory model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param string $id * @return TaxonomyCategory the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = TaxonomyCategory::findOne(['id' => $id])) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }