Support the ongoing development of Laravel.io →
Views Blade
Last updated 2 years ago.
0

The problem is with the quotes, to use string interpolation in PHP you have to use double quotes, like this:

@if (isset($page))
    @include("dashboard.dashPages.$page")
@else 
    @include('dashboard.dashPages.MainPage') 
@endif

If you use single quotes, PHP will skip the interpolation, and just return $page as a string, and not as a variable.

Last updated 9 years ago.
0

Thank you,

Completely forget about that. Such an easy answer haha.

Have a nice day !

0

Sign in to participate in this thread!

Eventy

Your banner here too?

domeinznl domeinznl Joined 7 Sep 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.