I am migrating a theme to Sage9 and I have a shortcode that allows a template to be passed, which leverages get_template_part()
. Any thoughts on how to include blade templates from a php class/function?
1 Like
You’re looking for template_path()
which will return the compiled blade template path.
Example Usage
include \App\template_path(locate_template('path/to/file.blade.php'));
6 Likes
@Log1x Could you show us an example of path please?
1 Like
include \App\template_path(locate_template('views/partials/user-review.blade.php'));
5 Likes
is there any same function in sage 10 to load blade templates like this?
I tried your code in sage 10 and I am getting the following error
Illuminate \ View \ ViewException (E_ERROR)
Call to undefined function App\template_path()
\Roots\view
would be what you’re looking for. Open a new thread though if you find you need more help with it.