I am trying to keep all the PHP files separated from the HTML files. Sort of a template based project but without using any template engines as they ar
You need to use the extract() function in PHP to get this sorted out. It will then start working as a Controller - View architecture that you are looking for.
For example:
Then directly use $product_list
in the view section. This should do it.
Working example:
Create a new File naming it workingExampleView.php: