How To Define A Variable In Controller And Access It In Tpl File

i want to assign a array variable in function “fn_send_product_notifications” and access that array variable in tpl file “mange.tpl” file

First off you should be using hooks.

Which 'manage.tpl' file? There are several and usually there is one for each controller (note that 'manage' is a mode).

@anilkumar,



Hope our answer will help you to solve your problem.



If the function is used with the GET method:



php:


Registry::get('view')->assign('my_array', $my_array);




templates:


{foreach from=$my_array item="_item"}
{$_item}
{/foreach}




If the function is used with the POST method:



php:


$_SESSION['my_array'] = $my_array;




templates:


{foreach from=$smarty.session.my_array item="_item"}
{$_item}
{/foreach}




Thanks.