/** * Initializes the widget. * This renders the form open tag. */ public function init() { if (!isset($this->options['id'])) { $this->options['id'] = $this->getId(); } echo Html::beginForm($this->action, $this->method, $this->options); }
?> </head> <body> <?php $this->beginBody(); ?> <div class="wrap"> <?php NavBar::begin(['brandLabel' => 'CodeForge', 'brandUrl' => Leaps::$app->homeUrl, 'options' => ['class' => 'navbar-inverse navbar-fixed-top']]); $menuItems = [['label' => '威客', 'url' => ['/site/index']], ['label' => '源代码', 'url' => ['/site/code']], ['label' => '活动', 'url' => ['/event']], ['label' => 'CF币', 'url' => ['/site/cfcoin']], ['label' => '关于我们', 'url' => ['/site/about']], ['label' => '联系我们', 'url' => ['/site/contact']]]; if (Leaps::$app->user->isGuest) { $menuItems[] = ['label' => '注册', 'url' => ['/site/signup']]; $menuItems[] = ['label' => '登陆', 'url' => ['/site/login']]; } else { $menuItems[] = '<li>' . Html::beginForm(['/site/logout'], 'post') . Html::submitButton('Logout (' . Leaps::$app->user->identity->username . ')', ['class' => 'btn btn-link']) . Html::endForm() . '</li>'; } echo Nav::widget(['options' => ['class' => 'navbar-nav navbar-right'], 'items' => $menuItems]); NavBar::end(); ?> <div class="container"> <?php echo Breadcrumbs::widget(['links' => isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : []]); ?> <?php echo ''; ?> <?php echo $content; ?>