Smarty: Modifiers and &$smarty
| From: | Ulf Wendel | Date: | Fri, 14 Dec 2001 00:55:26 +0000 |
| Subject: | Smarty: Modifiers and &$smarty | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-77687@lists.php.net to get a copy of this message | ||
Hi,
is there a way to access the calling smarty object from withing a modifier callback function?
Regular smarty callback functions get passed a list of "parameters" of the function call as a first argument and a reference to the calling smarty object as a second argument.
function my_smary_func($params, &$smarty) {
...
if (my_smarty_check_params($params, $allowed)) {
return true;
}$smarty->assign(); ... } That way you can not only modify the smarty object but access properties of the object. Two of them help me to generate error messages: $smarty->_current_line_no and $smarty->_current_file (btw. one should "make them public"). function my_smarty_check_params($params, $allowed, &$smarty) { .... if (...) {
return sprintf("Error on %s %d", $smarty->_current_file, ...);
}
...
}
Can I do something similar with modifiers, which seem to have this
format. Is there a way to access the calling smarty object?
function my_smarty_modifier($value, $option = '', ...) {
??? $smarty->... ???
}
Ulf