ft_eval_smarty_string

This is a powerful function that can process any string as a Smarty template, returning the string result. The way it works is quite simple. You pass the string containing the Smarty logic / variables, and a list of placeholders and their replacement values. It does the task of parsing the Smarty string and returning the result. Here's an example. Imagine your language file contained this rule:

$L["phrase_num_settings_to_complete"] = "You have {\$num_settings} settings to complete.";

Then, you can process that string to replace the $num_settings Smarty variable like so:

$placeholders = array("num_settings" => 5);
$string = ft_eval_smarty_string($L["phrase_num_settings_to_complete"], $placeholders);
echo $string; // "You have 5 settings to complete."
Edit Page