I am passing variable in my view partial but in partial it says variable not found. I am doing following(L v5.3)
@include('partials._latest',['title' => 'Latest Products','entries' => $entries])
and in partial I am calling as {{$title}}
I am getting:
ErrorException in 4ffcd30ab3dcb337e74cecc7f61f71723f113d8f.php line 3:
Undefined variable: title (View:..
Could you provide us your template flow?
From your question, I can understand these:
_latest.blade.php
inside partials
folderinclude
-ing partials/_latest, passing $title variablepartials/_latest
is receiving the variable $titleYou can re-check here if you have not : https://laravel.com/docs/5.3/blade#including-sub-views
What I can tell is, you put {{ $title }}
in some other files. This is the probable issue you are having. Extra $title variable laying around in unnecessary file.
Try rechecking all your other template file, I am sure there is extra {{ $title }}
around. You can check which file has that extra variable by reading carefully the debug message.
Cheers.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community