How to access jrCore_get_flag('my-custom-array') in tpl file

sbhadauria
@sbhadauria
9 years ago
129 posts
I have created a global array in include.php file of my custom module

$tmp = array(
'one' => 'one',
'two' => 'two'
);
jrCore_set_flag('my-custom-array', $tmp);


Now I want to access this array in tpl file.

Please help.
updated by @sbhadauria: 05/22/15 11:38:40AM
brian
@brian
9 years ago
10,148 posts
You need to include it as a replacement key in your jrCore_parse_template call - i.e.

$tmp = jrCore_get_flag('my-custom-array');
$_rp = array(
    'my_custom_array' => $tmp
);
$out = jrCore_parse_template('my-custom.tpl', $_rp, 'myModule');

Inside my-custom.tpl you can reference $my_custom_array.


--
Brian Johnson
Founder and Lead Developer - Jamroom
https://www.jamroom.net

Tags