Help with Paths

I am doing a book example and trying to understand what path to use.

It tells me to define these constants…

	// Constants
	define('BASE_URI', '/path/to/Web/parent/folder/');
	define('BASE_URL', 'www.example.com');
	define('MYSQL', '/path/to/mysql.inc.php');

It says the first one should point to the parent of my Web Root Directory, but I am using NetBeans on my laptop, and I can’t go above my project folder.

And for the second one what is my Web Root Directory?

Is it a slash (/) ??

TomTees

Where are the files that are part of the website (e.g. index.html) stored – in the project folder, or a subdirectory like public_html?

The second one is mixed up, because it’s called BASE_URL but the value is not a URL, it’s just a hostname. I don’t know what kind of setup you have, but your hostname might be localhost and your base url something like http://localhost/some_directory/.

I am using NetBeans for development, so all of my files are in the project folder, which I guess makes it my Root Web Folder.

But how do I translate that to my constant?

I thought a backslash / meant to use the current folder…

The second one is mixed up, because it’s called BASE_URL but the value is not a URL, it’s just a hostname.

Originally I said…

	define('BASE_URL', 'www.example.com');

but since I don’t have a website yet, I don’t know how to point that to my files in NetBeans.

I’d say it is the same as my comments above.

I don’t know what kind of setup you have, but your hostname might be localhost and your base url something like http://localhost/some_directory/.

NetBeans takes care of mapping where the files in my project folder are located so when I run them they launch in the browser.

My questions were just how to I assign my project folder (i.e. Web Root) to a constant since I don’t have a URL.

Follow me?

TomTees

When using a single entry point you can use the below. If its possible to enter from multiple points, than you might be better off with $_SERVER[‘DOCUMENT_ROOT’];


// absolute www directory path
define('WWW',str_replace('//','/',dirname(__FILE__)));

Parent of the web root would than be:


define('WWW_PARENT',WWW.'/..');

Oddz,

I need to read further and figure out what the author has in mind.

We’ll have to revisit your suggestions once I get farther in his code.

Thanks,

TomTees