소스 검색

Liens entre le backend et le frontend

Les adresses ne sont pas les même entre le server localhost et le serveur distant en ce qui concerne le frontend et le backend. Ces liens sont donc générés en fonction du serveur sur lequel le site est exécuté.
prodstable
keun 8 년 전
부모
커밋
213562fa6f
2개의 변경된 파일8개의 추가작업 그리고 2개의 파일을 삭제
  1. +7
    -1
      backend/views/layouts/main.php
  2. +1
    -1
      frontend/views/layouts/main.php

+ 7
- 1
backend/views/layouts/main.php 파일 보기

@@ -51,9 +51,15 @@ AppAsset::register($this);
'url' => ['/site/logout'],
'linkOptions' => ['data-method' => 'post']
];
if(Yii::$app->getRequest()->serverName == 'localhost')
$url = '../../frontend/web/' ;
else
$url = 'http://www.laboiteapain.net/' ;
$menuItems[] = [
'label' => '<span class="retour-site">Retour sur le site</span>',
'url' => '../../frontend/web/',
'url' => $url,
];
}
echo Nav::widget([

+ 1
- 1
frontend/views/layouts/main.php 파일 보기

@@ -48,7 +48,7 @@ AppAsset::register($this);
<li><a <?php if(Yii::$app->controller->id == 'commande' && Yii::$app->controller->action->id == 'create'): ?>class="active" <?php endif; ?>href="<?php echo Yii::$app->urlManager->createUrl('commande/create') ; ?>"><span class="glyphicon glyphicon-plus"></span> Commander</a></li>
<li><a <?php if(Yii::$app->controller->id == 'user' && Yii::$app->controller->action->id == 'update'): ?>class="active" <?php endif; ?>href="<?php echo Yii::$app->urlManager->createUrl('user/update') ; ?>"><span class="glyphicon glyphicon-user"></span> Profil</a></li>
<li><a id="link-logout" href="<?php echo Yii::$app->urlManager->createUrl('site/logout') ; ?>"><span class="glyphicon glyphicon-off"></span> Déconnexion<br /><span class="nom"><?php echo Html::encode(Yii::$app->user->identity->prenom .' '. substr(strtoupper(Yii::$app->user->identity->nom), 0, 1).'.') ; ?></span></a></li>
<?php if(Yii::$app->user->identity->isBoulanger()): ?><li><a class="" id="link-espace-boulanger" href="<?php if(Yii::$app->getRequest()->serverName == 'localhost'): ?>../../backend/web/<?php else: ?>boulanger.laboiteapain.net<?php endif; ?>"><span class="glyphicon glyphicon-grain"></span> Espace boulanger</a></li><?php endif; ?>
<?php if(Yii::$app->user->identity->isBoulanger()): ?><li><a class="" id="link-espace-boulanger" href="<?php if(Yii::$app->getRequest()->serverName == 'localhost'): ?>../../backend/web/<?php else: ?>http://boulanger.laboiteapain.net<?php endif; ?>"><span class="glyphicon glyphicon-grain"></span> Espace boulanger</a></li><?php endif; ?>
<?php else: ?>
<li><a <?php if(Yii::$app->controller->id == 'site' && Yii::$app->controller->action->id == 'login'): ?>class="active" <?php endif; ?>href="<?php echo Yii::$app->urlManager->createUrl('site/login') ; ?>"><span class="glyphicon glyphicon-log-in"></span> Connexion</a></li>
<li><a <?php if(Yii::$app->controller->id == 'site' && Yii::$app->controller->action->id == 'signup'): ?>class="active" <?php endif; ?>href="<?php echo Yii::$app->urlManager->createUrl('site/signup') ; ?>"><span class="glyphicon glyphicon-user"></span> Inscription</a></li>

Loading…
취소
저장