Click here to Skip to main content
15,914,642 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.

 
GeneralRe: PHP Pin
David O'Neil6-Oct-14 14:02
professionalDavid O'Neil6-Oct-14 14:02 
GeneralRe: PHP Pin
Jeremy Falcon6-Oct-14 14:08
professionalJeremy Falcon6-Oct-14 14:08 
GeneralRe: PHP Pin
David O'Neil6-Oct-14 14:25
professionalDavid O'Neil6-Oct-14 14:25 
GeneralRe: PHP Pin
Jeremy Falcon6-Oct-14 14:36
professionalJeremy Falcon6-Oct-14 14:36 
GeneralRe: PHP Pin
David O'Neil6-Oct-14 15:29
professionalDavid O'Neil6-Oct-14 15:29 
GeneralRe: PHP Pin
Jeremy Falcon7-Oct-14 4:07
professionalJeremy Falcon7-Oct-14 4:07 
GeneralRe: PHP Pin
David O'Neil7-Oct-14 8:25
professionalDavid O'Neil7-Oct-14 8:25 
GeneralRe: PHP Pin
Jeremy Falcon7-Oct-14 9:32
professionalJeremy Falcon7-Oct-14 9:32 
I get what you're saying now. Then all that's needed to make the base directory one level higher. You can do that by calling dirname twice from landing.php like so:
PHP
define('BASE_PATH', realpath(dirname(dirname(__FILE__))) . DIRECTORY_SEPARATOR);

And then you could build on top of that to have a public path as well.
PHP
define('BASE_PATH', realpath(dirname(dirname(__FILE__))) . DIRECTORY_SEPARATOR);
define('PUB_PATH', BASE_PATH . 'public_html' . DIRECTORY_SEPARATOR);

So now BASE_PATH points to [serverSpecificStuff]/home/user/ and PUB_PATH points to [serverSpecificStuff]/home/user/public_html/ and you can use them as needed when including files.

There is one tiny caveat to this however, if the files are located just one level up from / then you'll end up with something like //, which isn't a valid directory. So as long as your files aren't directly in /home then you're good to go no matter where you put the files on the system and no matter how they are invoked.
Jeremy Falcon

GeneralRe: PHP Pin
Jeremy Falcon7-Oct-14 9:37
professionalJeremy Falcon7-Oct-14 9:37 
GeneralRe: PHP Pin
David O'Neil7-Oct-14 9:48
professionalDavid O'Neil7-Oct-14 9:48 
GeneralRe: PHP Pin
Jeremy Falcon6-Oct-14 10:29
professionalJeremy Falcon6-Oct-14 10:29 
GeneralRe: PHP Pin
Marc Clifton6-Oct-14 10:37
mvaMarc Clifton6-Oct-14 10:37 
GeneralRe: PHP Pin
Jeremy Falcon6-Oct-14 10:44
professionalJeremy Falcon6-Oct-14 10:44 
GeneralRe: PHP Pin
Marc Clifton6-Oct-14 12:38
mvaMarc Clifton6-Oct-14 12:38 
GeneralRe: PHP Pin
Jeremy Falcon6-Oct-14 12:50
professionalJeremy Falcon6-Oct-14 12:50 
GeneralRe: PHP Pin
Marc Clifton6-Oct-14 13:31
mvaMarc Clifton6-Oct-14 13:31 
GeneralRe: PHP Pin
Jeremy Falcon6-Oct-14 13:55
professionalJeremy Falcon6-Oct-14 13:55 
GeneralRe: PHP Pin
Jeremy Falcon6-Oct-14 13:59
professionalJeremy Falcon6-Oct-14 13:59 
GeneralRe: PHP Pin
ed welch6-Oct-14 10:45
ed welch6-Oct-14 10:45 
GeneralRe: PHP Pin
DaveX866-Oct-14 13:52
DaveX866-Oct-14 13:52 
GeneralI like the CP slot machine Pin
CDP18026-Oct-14 9:26
CDP18026-Oct-14 9:26 
JokeRe: I like the CP slot machine PinPopular
Chris Maunder6-Oct-14 9:34
cofounderChris Maunder6-Oct-14 9:34 
GeneralRe: I like the CP slot machine Pin
CDP18026-Oct-14 9:37
CDP18026-Oct-14 9:37 
GeneralRe: I like the CP slot machine Pin
Chris Maunder6-Oct-14 10:06
cofounderChris Maunder6-Oct-14 10:06 
GeneralRe: I like the CP slot machine Pin
CDP18026-Oct-14 10:14
CDP18026-Oct-14 10:14 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.