예제 #1
0
<?php

use yii\helpers\Html;
use common\models\Type;
$type = Type::findOne($model->type_id);
?>

<!-- Содержание -->
<?php 
echo $this->render('block/' . $type->code, ['model' => $model]);
예제 #2
0

$blocks_array = $query->all();

// Подгрузка параметров из конфига
$phone = \Yii::$app->params['phone'];


// Меню лендинга
$menu = array();

// Добавление пунктов
foreach ($blocks_array as $block_array){

	// Тип блока
	$type = Type::findOne($block_array->type_id);

	if (($block_array->menu_label) and ($type->code)) {
		$menu[] = [
			'label' => $block_array->menu_label,
			'url' => '#' . $type->code,
			'options' => [
				'class' => $block_array->menu_class,
			]
		];
	}
}

?>

<nav id="header" class="navbar navbar-inverse navbar-fixed-top">
 /**
  * Finds the Type model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Type the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Type::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }