Example #1
0
if (Yii::$app->user->isGuest) {
    $items = [['label' => 'Login', 'url' => ['/site/login']], ['label' => 'Sign Up', 'url' => ['/site/signup']]];
} else {
    $items = [['label' => 'Search Advert', 'url' => ['/advert/index']], ['label' => 'My Account', 'url' => ['/user/account']], ['label' => 'Logout (' . Yii::$app->user->identity->getFullName() . ')', 'url' => ['/site/logout'], 'linkOptions' => ['data-method' => 'post']]];
}
echo Nav::widget(['options' => ['class' => 'navbar-nav navbar-right hohoho'], 'items' => $items]);
NavBar::end();
?>

    <div class="container">
        <?php 
echo Breadcrumbs::widget(['links' => isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : []]);
?>

        <?php 
echo AlertWidget::widget();
?>
        <?php 
echo $content;
?>
    </div>
</div>

<pre>
    POST:
    <?php 
print_r($_POST);
?>
    GET:
    <?php 
print_r($_GET);
Example #2
0
?>

<div class="wrap">
    <?php 
NavBar::begin(['brandLabel' => 'My Company', 'brandUrl' => Yii::$app->homeUrl, 'options' => ['class' => 'navbar-inverse navbar-fixed-top']]);
echo Nav::widget(['options' => ['class' => 'navbar-nav navbar-right'], 'items' => [['label' => 'Home', 'url' => ['/site/index']], ['label' => 'Advert', 'url' => ['/advert/index']], ['label' => 'User CRUD', 'url' => ['/user/index']], ['label' => 'Sign Up', 'url' => ['/site/signup']], Yii::$app->user->isGuest ? ['label' => 'Login', 'url' => ['/site/login']] : ['label' => 'Logout (' . Yii::$app->user->identity->getFullName() . ')', 'url' => ['/site/logout'], 'linkOptions' => ['data-method' => 'post']]]]);
NavBar::end();
?>

    <div class="container">
        <?php 
echo Breadcrumbs::widget(['links' => isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : []]);
?>

        <?php 
echo \app\components\AlertWidget::widget();
?>
        <?php 
echo $content;
?>
    </div>

    <?php 
echo '<pre>';
echo '<b>$_POST: </b>';
print_r($_POST);
echo '<b>$_GET: </b>';
print_r($_GET);
?>

</div>