I'm trying to do something similar to this:
include/require php file within phtml template file
I have a .phtml file but need to get the return value from another php file by calling it from said .phtml file. How can this be achieved in Magento 2?
I tried using require
, include
and require_once
with the path relative to the location of the .phtml file but this doesn't work (returns 500 error on page).
To make things somewhat clearer (I'm using a custom module):
- I have a Settings.php file in a folder called Helper (folder located in root of custom module, so Vendor/Module/Helper)
- Following, I have a template.phtml file under view/frontend/templates
- I want to get the return value from a function in Settings.php