Parsing Custom Php To All Frontend Pages

Hi All.

I've got a php function that I need to call on all frontend pages, which will setup a variable to be used in the footer of the site.

I'm trying to use the my_changes add-on as follows

init.php

fn_register_hooks(
   'index_footer'
);

func.php
use Tygh\Registry;

if ( !defined(‘AREA’) ) { die(‘Access denied’); }

function fn_my_changes_index_footer()
{
$a_computed_value = ‘blarblabrl’;
Registry::get(‘view’)->assign(‘something’, $a_computed_value);
exit($a_computed_value);
}

Yet its doing nothing? I tried finding the hook from https://www.cs-cart.com/api

Really struggling to figure out how to do custom logic and pass it to templates of my choice, documentation seems very hard to understand if your not familiar with hook systems or smarty :(

Easier to just add a post controller like:

app/addons/my_changes/controllers/frontend/init.post.php

assign('my_variable_value', $my_variable_value);
return array(CONTROLLER_STATUS_OK);

As alternative, you can create the following template:

design/themes/YOUR_THEME/templates/addons/barcode/hooks/index/footer.post.tpl

and use the following code there:

{$some_variable|fn_my_changes_index_footer}

The function can return text or html in this case