0

I have got a some php files in my root directory, such as:

  • root/start.php
  • root/news.php
  • root/contact.php

All of these files include a navigation.php from the directory

  • root/include/navigation.php

This navigation.php is basically a header which contains (relative) links to the different files, such as to start.php or news.php. This works perfectly fine.

However, I'm having trouble to make this work, if some of my files are not in the root directory but in a sub-directory, for instance:

  • root/text/text_01.php

If I include the navigation.php in this file, the links in the navigation do not work anymore (because they are not on the same level). To illustrate this, the start.php is not the same directory as the text_01.php.

What's the best way to solve this issue? Absolute paths, or is there another solution for that? I appreciate your help!

2
  • To make the navigation.php work everywhere, yes: absolute paths. Commented Mar 1, 2015 at 20:29
  • Ok, then I'll do that, I guess. Thanks, bobdye! Commented Mar 1, 2015 at 20:32

1 Answer 1

0
> define('ABSPATH', dirname(__FILE__) . '/' );
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.