You're is not following the MVC pattern, you are just using global variables to display something in a "shared all"-script in a "shared nothing"-architecture.
Doing output can mean you get a view of something, but normally that is not to be mixed with the term View of the MVC (Model-View-Controller) pattern. What you do, templating or output is maybe a better wording.
If this is not the proper way to do things, please tell me why, and what is the proper way.
If you want to implement MVC pattern, than this might be the MVC you're referring to:
- Model: Your Filesystem and Database
- View: Your HTML output + CSS + JS
- Controller: Your PHP Script
MVC is just a pattern. You can implement it like you feel good. And you can find it in lot of stuff that has implemented nothing. It's just a pattern.
But more precisely the MVC pattern is more commonly seen for an object oriented implementation of it. Your implementation is totally different to such of a object oriented one, you're using global state instead of object instances.
But you have not written in your question that you thought about implementing an object oriented MVC pattern and that templating script you use is part of it.
It can be perfectly proper to do it like you do it depending on the needs to fulfil.
MVC is just a pattern. It has pro's and con's. It has benefits and it has consequences. It's just a pattern.
Especially if you're concerned about performance don't make things more complicated as they need to be, e.g. loading a full blown object tree to just display some variables inside a HTML template.