I use Symfony and boostrap to customize the style of my website. I have a twig file : register_content.html.twig which contains a register form.
In my index.html.twig I want to have something like that :
<a href="{{ path('fos_user_registration_register') }}" class="btn" data-toggle="modal">Je m'inscris !</a>
To display the content of the register form in a modal window, but it doesn't work.
I try to use the twitter-bootstrap documentation here : http://bootstrap.braincrafted.com/javascript#modals
But I can't find a way to apply it easily for twig in symfony...
Could you help me ?
Thanks
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:
Integrate the register form inside your
index.html
in a modal box and following the bootstrap example for a static modal box:You could also load the content for the registration form through ajax. In this case, see the remote option for modals:
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.