Jump to content

Recommended Posts

If I'm in a subfolder on my site how do I call a file from the base folder?

 

I'm in the folder "Scripts" for example and I want to call a function from the parent folder.

I know you could use "../" if I remember right, but I'm looking for a php function.

 

It would use scripts something like this...

 

include $basefunction . "/index.php"

I'm having a hard time understanding your question.

 

Typically you would define the base application directory. That way your paths and includes are always consistent. So instead of having random "../", "../../someotherdir/blah", etc spread out in your code, it would be more like $basedir/someotherdir/blah. $basedir would be the absolute path, not a relative one (../ is relative).

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.