I’m making the switch from CodeIgniter to Symfony 2.
Can someone please give me an example of how to:
- Get the base url (the url without the route specific parts)
- Globally pass this variable to the twig bundle so I can use it in every template.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Why do you need to get this root url ? Can’t you generate directly absolute URL’s ?
This Twig code will generate the full http:// url to the _demo_hello route.
In fact, getting the base url of the website is only getting the full url of the homepage route :
(homepage, or whatever you call it in your routing file).