|
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 |
log1st Smarty n00b
Joined: 03 Oct 2014 Posts: 2
|
Posted: Fri Oct 03, 2014 11:47 pm Post subject: String_format |
|
|
Is it possible to set more than one parameter in string_format?
Config:
join_form_login_hint="From %1n to %2n symbols. Available symbols: %3n"
Template:
{2,3,A-z|string_format:{#join_form_login_hint#}} |
|
Back to top |
|
log1st Smarty n00b
Joined: 03 Oct 2014 Posts: 2
|
Posted: Sat Oct 04, 2014 12:54 am Post subject: Solved |
|
|
Solved this problem via editing file smarty/plugins/modifiercompiler.string_format.php:
Code: |
function smarty_modifiercompiler_string_format($params, $compiler)
{
$more=explode('###',$params[0]);
if(count($more)>1) {
$parames=implode('\',\'',$more).'';
} else {
$parames=$params[0];
}
return 'sprintf(' . $params[1] . ',' . $parames . ')';
}
|
Then add string like this in template file:
Code: |
{'2###12###A-z'|string_format:"{#join_form_login_hint#}"}
|
|
|
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
|