|
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 |
omexlu Smarty Rookie
Joined: 13 Mar 2014 Posts: 27
|
Posted: Sun Nov 26, 2017 8:01 am Post subject: |
|
|
Hello,
I have one question is it possible to add time to a variable:
Code: | {$lastSportEntry.date|"+1 hour"|date_format:"%H:%M:%S"} |
This don't work, is this possible?
Thanks |
|
Back to top |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
|
Back to top |
|
omexlu Smarty Rookie
Joined: 13 Mar 2014 Posts: 27
|
Posted: Sun Nov 26, 2017 4:30 pm Post subject: |
|
|
Thanks for your reply.
Yes sure but it is not possible to do this in template? |
|
Back to top |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
Posted: Sun Nov 26, 2017 8:20 pm Post subject: |
|
|
It is possible, but complicated.
To make it less complicated, you could write a custom modifier for your case.
Also, please don't resurrect a ten-years-old topics anymore. |
|
Back to top |
|
omexlu Smarty Rookie
Joined: 13 Mar 2014 Posts: 27
|
Posted: Wed Nov 29, 2017 1:07 pm Post subject: |
|
|
Hi,
Okay thank you.
How can i use second parameter in template with the costumer modifier?:
Code: | $smarty->registerPlugin("modifier","demoTPL", "demo");
function demo($first, $second)
{
return $first . $second;
} |
Thanks? |
|
Back to top |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
Posted: Wed Nov 29, 2017 1:42 pm Post subject: |
|
|
Same as with any other modifier.
Code: | {param1|modifier:param2[…:paramN]} |
|
|
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
|