I develop my project at ~/Dropbox/db/. I need to move the folder continuously to /var/www to be able to see the result in Firefox because it is the only place where I have Apache.
My filetree is at ~/Dropbox/db/
.
|-- handlers
| |-- login.php
| |-- question.php
| |-- question_answer.php
| `-- register.php
|-- index.php
|-- forms
| |-- login.php
| |-- question.php
| |-- question_answer.php
| `-- register.php
I have for instance the following reference in the file ~/Dropbox/db/forms/login.php:
include '../handlers/login.php';
which is awful, since everything breaks after a while. For instance, I start Firefox at index.php. This means that all PATHS are relative to index.php. This makes the command above meaningless.
Perhaps, the only solution to the problem is to make all PATHs absolute in all my files. I have tried to avoid this because this would force me to use SED's replacement command.
I would like to have a similar command as LaTeX's \graphicspath
for forms and handlers such that I can simply say where to find the given files in one file. I found out that PHP has the following function which needs to be at the beginning of index.php. However, it does not seem to be enough, since I cannot extend it to forms and handlers, for instance.
$path_parts = pathinfo('/var/www/index.php');
How can you have a LaTeX-like PATH -system for PHP?