Jump to content

philosopherdog

New Members
  • Posts

    3
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

philosopherdog's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. cool thanx. Why's that? Are you serving the site out of a subfolder or something? Yes. Actually, when I tried that it wanted the whole path to the apache server as part of the include. I'm assuming this is going to be different when I deploy it since it's going up on a windows server (unfortunately).
  2. Yes, my mistake. Thanx for the quick reply. Just so I understand what's happening here __DIR__ grabs the current directory. So, let's say my header.php is in the views folder. require_once __DIR__ . "/path/../to/../header.php"; will append the current directory to this path. So, let's say the current directory is forum/views. So it would render as require_once 'forum/views/header.php'; And when I try to include it from the root index.php instead of the one in the views folder it will render it as require_once 'header.php'; Is this correct? Now is there a way to add this to a config file so that I don't have to make my include files so verbose? How do I do that? I found that the $_SERVER["DOCUMENT_ROOT"] option was a nuisance because I'm developing using a local server, which means I have to change all my paths when I deploy. Thanx.
  3. Hi, I'm pretty new to php and need a bit of basic help. I have a header and footer include file in a "views" folder. The header itself has a function that's included from another directory. Now when I try to include the header in by index.php in the root it throws and error saying it can't find my function include. Obviously the include directory is relative to the file it's included in. So, what's the trick to fixing this problem? And what's the lesson for future projects? Thanx in advance.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.