Question

I've just started using Slim and Twig and getting to grips with it all.

I am building a small site and will have a Twitter feed on every page. So, I want to put this in my layout template (base.html.twig). The only way I can see to do it is to pass it in to every route and then use an include that can access the details.

Seems like there must be a way to set it in the layout template once without passing it in through every route?

Any help or a related link would be great.

Was it helpful?

Solution

you can extend twig with user defined functions, just make a call inside template and you will not need for passing it every time http://twig.sensiolabs.org/doc/advanced.html#creating-an-extension

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top