2014-11-14 82 views
0

我嘗試重寫FOS捆綁。overrid FOS捆綁

要做到這一點,我有:intalling FOS當我創建

UserBundle。它有我的User.php文件。

UserBundle.php:

<?php 

namespace gestEntrSym\UserBundle; 

use Symfony\Component\HttpKernel\Bundle\Bundle; 

class UserBundle extends Bundle 
{ 
    public function getParent() { 
    return 'FOSUserBundle'; 
    } 
}  

的意見/預設/ layout.html.twig

{% extends '::base.html.twig' %} 

{% block title %}Acme Demo Application{% endblock %} 

{% block content %} 
    {{ block('fos_user_content') }} 
{% endblock %} 

那麼我的應用程序/ Ressources /瀏覽/ base.html.twig

<!DOCTYPE html> 
<html> 
    <head> 
     <meta charset="UTF-8" /> 
    </head> 
    <body> 
     <div> 
      {% if is_granted("IS_AUTHENTICATED_REMEMBERED") %} 
       {{ 'layout.logged_in_as'|trans({'%username%': app.user.username}, 'FOSUserBundle') }} | 
       <a href="{{ path('fos_user_security_logout') }}"> 
        {{ 'layout.logout'|trans({}, 'FOSUserBundle') }} 
       </a> 
      {% else %} 
       <a href="{{ path('fos_user_security_login') }}">{{ 'layout.login'|trans({}, 'FOSUserBundle') }}</a> 
      {% endif %} 
     </div> 

     {% for type, messages in app.session.flashBag.all %} 
      {% for message in messages %} 
       <div class="{{ type }}"> 
        {{ message|trans({}, 'FOSUserBundle') }} 
       </div> 
      {% endfor %} 
     {% endfor %} 

     <div>aaa 
      {{ block('fos_user_content') }} 
     </div> 
    </body> 
</html> 

我現在在頁面上只有一個鏈接「Connexion」,它只是鏈接到頁面登錄。我想在我的佈局頁面中輸入所有輸入。

我該怎麼做?

感謝 問候

回答

0

如果要覆蓋登錄模板,創建文件夾

應用程序/資源/ FosUserBundle

,然後尊重供應商的文件夾結構你不會說什麼,所以你的覆蓋登錄將在這裏:

應用程序/資源/ FosUserBundle /瀏覽/安全/ login.html.twig

然後,如果你想在基礎,模板,

{% include('FOSUserBundle:Security:login.html.twig') %}