I am learning Symfony, coming from a Laravel background. So far I have found it to be a bit quirky, to say the least. I just ran into a strange issue and I wanted to know if anyone has seen anything like this.
I use the http://myapp.local/web/app_dev.php route so I can see the dev toolbar and get more verbose error messaging. One thing I noticed is that when I use the prod route: http://myapp.local/web/app.php I get the following error:
Unknown "truncate" filter in "Post/post.html.twig" at line 12
The offending line is:
<p> {{ post.body | truncate(400) }} </p>
Why would this line of code work in dev but not prod? I've tried messing with the cache, etc. but nothing seems to work. Neither the app.php nor app_dev.php file has been modified.
Check if you have in your services.yml:
services:
twig.extension.text:
class: Twig_Extensions_Extension_Text
tags:
- { name: twig.extension }
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.