Question: I'm trying to create simple function that can be executed on **any page**.

```
function something() {
    $string = 'Hello World'; 
    return $string;
}

```

Let's say I'm in the category page, I would just call `$a = something();` and it would return my value

Platform : OpenCart

*P.S. I'm still studying MVC architecture*

Answer: 
Since you are wanting to understand and learn about the MVC system, the correct way to go about this would be to create your own helper file and put it in `/system/helper/` and then add the helper to `system/startup.php`. Take a look at how the `json.php` / `utf8.php` are done in these as a guide
You can create a function in any opencart library (system/library/)

As example in system/library/document.php 

```
    function something() {
    $string = 'Hello World'; 
    return $string;
}

```

And use anywhere in openсart as 

```
$something=$this->document->something();

```

P/s code in header.tpl will not work in ajax or direct request