smarty replace multiple values
问题 I have ..tpl file with this line: {$error|replace:"pno":"personal number error"} I need to modify it so multiple values will be replaced, sort of: {$error|replace:"pno_error":"personal number error", "error_1":"1", "error_2":"2"} I need to make sure the code is correctly formed. How do I achieve this? 回答1: Like so {assign "find" array('pno', 'error_1', 'error_2')} {assign "repl" array('personal number error', 1, 2)} {assign "text" 'error_1 and pno and error_2 are friends'} {$text|replace: