tags:

views:

328

answers:

1

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?

+7  A: 

Use compact.

$smarty->assign(compact('priorityList', 'groupview', 'processList', 'taskList'));
gnud