Roots Discourse

Include template with layout direct php error

Hey Guys. I have a problem with including template with layout direct in php. When I try to include in php template( \App\locate_template( [ 'views/password-form' ] ) I receive error.

My blade file:

@extends('layouts.app')

@section('content')
    @include('partials.password-form')
@endsection

I think problem is because methods from header.blade.php not found

What is the error you get?

To load a template in vanilla PHP, use template('password-form').

Assuming password-form is a Blade file located at resources/views/partials/password-form.blade.php, do this:

return \App\template('partials/password-form') 
# or echo instead of return depending on usage

**Fatal error** : Uncaught Symfony\Component\Debug\Exception\FatalThrowableError: Call to a member function

The error looks like it’s missing some information. Are you able to share any more?
Also, sharing the full code snippet will help give insight to this.

This topic was automatically closed after 42 days. New replies are no longer allowed.