Reputation: 12538
For pages with lots of text and html tags, I quickly get a parsing error from Twig due to unexpected special characters. Has anybody else ran into this problem?
Unexpected character "!" in ... at line 76
I am trying to fix this problem by pasting the static information in a new page and then including it using include
.
My question is, where should I place a static HTML file so it can be included in a Twig file using {% include 'content.html' %}
? Currently the included file is in the FooBundle/Resources/views/Default
directory.
What is a good practice for overcoming this problem, and if include is the answer, where should the file be located to be included in a twig?
Note:
When I try to link to it using {% include 'content.html' %}
I get the following Symfony error:
Unable to find template "content.html" in ... at line 31
(broken link)
Upvotes: 0
Views: 6905
Reputation: 12538
I found a solution, drawing from various different posts. I ended up putting the raw html in a new file (which isn't required) and included it as follows:
{% include 'FooBundle:Default:content.html.twig' %}
Then inside my content.html.twig
I surrounded my raw HTML code with raw
Twig tags:
{% raw %}
// RAW HTML CODE HERE
{% endraw %}
Upvotes: 4
Reputation: 2512
Include like this
{% include 'YourProjectNameFooBundle:Default/content.html.twig' %}
Upvotes: 0