In my smarty code I write a lot of code such as this:
$smarty->assign('priorityList', $priorityList);
$smarty->assign("groupview", $groupview);
$smarty->assign('processList', key($processList));
$smarty->assign('taskList', $taskList);
See how annoying it has become; I use the same name for Smarty variables and PHP variables, and yet I need to waste time and typing to connect the two.
Is there any option that I can set, so that the smarty variables will be automatically mapped to the PHP variables with the same name?
Use compact.
$smarty->assign(compact('priorityList', 'groupview', 'processList', 'taskList'));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With