How create modal window with Twig template and Twitter-Bootstrap

送分小仙女□ 提交于 2019-12-04 03:33:34
Sgoettschkes

Your problem is totally unrelated to symfony or twig. You are missing data-attributes for the modal to work!

You can do it the following ways:

  1. Integrate the register form inside your index.html in a modal box and following the bootstrap example for a static modal box:

    <button type="button" data-toggle="modal" data-target="#myModal">I register !</button>
    
    <div id="myModal" class="modal hide fade">
        <!-- register form here -->
    </div>
    
  2. You could also load the content for the registration form through ajax. In this case, see the remote option for modals:

    <a data-toggle="modal" href="{{ path('fos_user_registration_register') }}" data-target="#myModal">click me</a>
    
    <div id="myModal"></div>
    

    Just make sure to not send any layout when an ajax request is performed against the url, because otherwise you'll have a complete html page inside your div, which is neither valid (html-page inside html-page) nor a good idea.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!