I have written custom smarty functions to work with Zend framework and now I would like them to be rewritten to zend structure, plz suggest how can I do that ? thanx. Here is the sample code for the same…
function smarty_function_render_table($params, &$smarty)
{
extract($params);
$sSortTableBy = $smarty->get_template_vars("sortTableBy");
$bSortTableOrderAsc = (boolean) (strlen($smarty->get_template_vars("sortTableOrder")) > 0 ? strtolower($smarty->get_template_vars("sortTableOrder")) == 'asc' : true);
$iSortTablePage = $smarty->get_template_vars("page");
Adx_Sort::getInstance()->multiSort($data, $sSortTableBy, $bSortTableOrderAsc);
$columnSettings = $smarty->get_config_vars($id);
Analog of the Smarty plugins are Zend View Helpers. You can write Zend View Helpers to make similar job as Smarty plugins did. Zend View Helpers is a class derived from the Zend_View_Helper_Abstract abstract class. View object is already accessible there via view public class member. get_template_vars is not needed – you can just get view custom vars directly from View object.
After you had created view helper, you can use it directly in every view script via direct calls: