Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

PHP Include file within another included file

Featured Replies

Okay, so this is going to sound like the most amature question ever. I remember needing to do something like this years ago but never figured it out, so here i am.

 

I have a structure like the following:

 

-------------

 

index.php (Includes file1.php

 

FOLDER1 > file1.php (This includes file2.php)

FOLDER2 > file2.php

 

--------------

 

So, index.php includes file1.php perfectly. But then errors out with file2.php. It says it cannot open stream. File not found.

I have changed file.php to the following configs but with no success...

 

include('../FOLDER2/file2.php');

include('FOLDER2/file2.php');

include('/FOLDER2/file2.php');

include('../../FOLDER2/file2.php');

 

Any idea how i can go about this?

 

 

Thanks in advance!

 

 

  • Author

 

Try:

 

include(__DIR__ . '/file2.php');

Had to change is slightly to:

include(__DIR__ . '/../file2.php');

But it worked! Thank you very much!!

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.