|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
n2fole00 Smarty Rookie
Joined: 09 Jun 2020 Posts: 7
|
Posted: Wed Jun 10, 2020 10:34 am Post subject: Problems with the truncate modifier |
|
|
Hi, I have the following I was trying out...
Code: |
{$controller|truncate:3} this just returns ...
{substr($controller,0,3)}... this works as expected (myc...)
{$title|substr($controller,0,3)}... this breaks the page
|
Note: $controller is a string like "MyControllerName".
Ideally, I would like to get the first line working, but it doesn't work as expected. Any ideas?
Thanks. |
|
Back to top |
|
bsmither Smarty Elite
Joined: 20 Dec 2011 Posts: 322 Location: West Coast
|
Posted: Wed Jun 10, 2020 7:35 pm Post subject: |
|
|
The docs mention:
"[The default trailing string, '...'] length is included in the truncation length setting."
So, maybe Code: | {$controller|truncate:6} |
|
|
Back to top |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
Posted: Thu Jun 11, 2020 4:43 pm Post subject: |
|
|
bsmither wrote: | The docs mention:
"[The default trailing string, '...'] length is included in the truncation length setting."
So, maybe Code: | {$controller|truncate:6} |
|
Or Code: | {$controller|truncate:4:\u{2026}} |
|
|
Back to top |
|
n2fole00 Smarty Rookie
Joined: 09 Jun 2020 Posts: 7
|
Posted: Thu Jun 11, 2020 7:28 pm Post subject: |
|
|
Yes, you're right! Darn my poor comprehension skills. |
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|