09.
Extra Credit Tricks and HTML Escaping
Keep on Learning!
If you liked what you've learned so far, dive in! Subscribe to get access to this tutorial plus video, code and script downloads.
If you liked what you've learned so far, dive in! Subscribe to get access to this tutorial plus video, code and script downloads.
Whoops, an error! Please, try again later.
7 Comments
If there is no block title you get error - (Block "title" on template "sth.html.twig" does not exist).
So {% if block('title') %} should be changed to {% if block('title') is defined %}
Hey RoGluee ,
Thanks for noticing us! Actually, it's interesting! I wonder what Twig version do you use? Is it the new 2.x? Because in older version 1.x of Twig I don't have that error for non-existent blocks.
Cheers!
you get a deprecation warning in recent 1.x versions (starting at the version where `block('title') is defined` became a valid syntax)
Hey Christophe,
Thanks for explanation! We added a note about this error.
Cheers!
Ah, nevermind about https://knpuniversity.com/s... . I already double checked it: the problem only affects Twig >=2.0. We'll add a note. Thank you for this report!
Cheers!
Hi I really like your videos about twig, I learned a lot. You have done a great work and make learning twig easy
But seriously Penguin, I m looking videos at work and my boss seems to think I'm surfing on the internet and not working :-( There are penguins all over the screen
Hey eCosinus ,
Haha, sorry.. probably too much penguins in one screencast :p
And thanks for the kind words!
Cheers!
"Houston: no signs of life"
Start the conversation!