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

Anyone?

Last updated 2 years ago.
0

have you tried this on your view?

@extends('../layout.header')
Last updated 2 years ago.
0

extjac said:

have you tried this on your view?

@extends('../layout.header')

Hey #extjac, thanks for your suggestion. Have tried it, does only work within a Blade view file. I then have to rename the view to index.blade.php. But I would like not to use the Blade syntax. I need and want to use only native PHP within the views. and require '...'; doesn't seem to work in other sub- or upper view folders. Only in the same folder.

I even left the header.php in a folder above /home directly under /views.

views
    header.php
    footer.php
    /home
        index.php

Then in index.php:

require '../header.php';

It doesn't work, gives the same error. Does normal file traversing work within the app folder structure?

Last updated 2 years ago.
0

Found a solution in calling the app_path()

require app_path().'/views/layout/header.php';

Now I just need to add a custom helper function for view_path(), so i can call it like:

require view_path().'/layout/header.php';

But that's another story.

Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

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.