I'm having trouble with nested includes. While I have seen there are a number if similar issues, they don't seem to help.
Generally I don't have problems with includes, but recently I have been trying something new and I cannot get the nested includes to work.
One solution: php nested include behavior
Basic setup:
- index.php includes '/include/header.php'
- header.php includes '/resources/login/index_alt.php'
- index_alt.php includes '/resources/login/index_auth.php'
- index_auth.php include '/class/Login.class.php' and '/class/Connection.class/php'
I do not actually write the paths like this (its to understand the depth). This is how it will look on the pages.
index.php:
- include('include/header.php');
header.php: (header is included at every depth level except for /resources/...)
- include('../resources/login/index_alt.php');
index_alt.php:
- include('index_auth.php');
index_auth.php:
- include('../../class/Login.class.php');
- include('../../class/Connection.class.php');
At some depth levels the header file is accepted, but includes nested in will not...