I am crash-learning PHP for a project, and I have a ton of stupid questions to make. The first is the following. I have a structure like this:
- index.php
- header.php
- images/
- data
- data.php
Now, the problem is that I want to include the header.php file in the data.php file. That is no problem.
The problem I have is that header.php has a link to the images folder in a relative way. So, the images won't load.
To make matters worse, this structure is under a specific alias, so I just can't append a / to the beginning of the link to the image.
What I need, I guess, is a way to get the path to the application in the script. That way I can reference to the images without worrying where the include is made.
How do you get this path in PHP?