|
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 |
mik3e Smarty n00b
Joined: 20 Aug 2013 Posts: 4
|
Posted: Tue Aug 20, 2013 2:58 pm Post subject: Multi-Replace variables in Text |
|
|
Hi,
I´m using the following form to define text in language files:
Code: | tax_shipping = 'Text with on %s1 variable and another %s2 variable'; |
In other systems I´m able to use a function which I pass the text and an array of variables to and those are replace one after the other.
I haven´t found such a function for smarty till now. So I´m doing an (ugly) workaround with replace:
Code: | {#tax_shipping#|replace:"%s1":$templateConfig->shipping->shippingCostUrl} |
Finally that works but the problem is: What to do if I´ve two or more variables in one text element?
I´m quite sure there is a function in smarty available which can do that for me. Maybe somebody has a hint for me!?
Thanks,
Michael |
|
Back to top |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 5068 Location: Hamburg / Germany
|
Posted: Tue Aug 20, 2013 6:01 pm Post subject: |
|
|
You can use
Code: | {sprintf(#tax_shipping#,$templateConfig->shipping->shippingCostUrl)} |
|
|
Back to top |
|
mik3e Smarty n00b
Joined: 20 Aug 2013 Posts: 4
|
Posted: Mon Aug 26, 2013 1:47 pm Post subject: |
|
|
Great, thanks - I´ll try it... |
|
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
|