Is there a truncate modifier for the blade templates in Laravel, pretty much like Smarty?
I know I could just write out the actual php in the template but i'm looking for something a little nicer to write (let's not get into the whole PHP is a templating engine debate).
So for example i'm looking for something like:
{{ $myVariable|truncate:"10":"..." }}
I know I could use something like Twig via composer but I'm hoping for built in functionality in Laravel itself.
If not is it possible to create your own reusable modifiers like Smarty provides. I like the fact that Blade doesn’t overkill with all the syntax but I think truncate is a real handy function to have.
I'm using Laravel 4.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…