Jump to content

Help setting up Path Constants


TomTees

Recommended Posts

I am following a book and need help setting up Path Constants.

 

Here is the script I need to adjust...

 

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

Since I am working in NetBeans, I do not have access above my Project Folder which serves as my "Web Root".

 

So if my Project Folder is called "MyProjectFolder", and I want both BASE_URI and BASE_URL to point to that directory on my laptop, what should I put?

 

I'm thinking something like this...

 

	// Constants
define('BASE_URI', '/');
define('BASE_URL', '/');
define('MYSQL', '/includes/mysql.inc.php');

 

 

 

TomTees

 

 

Link to comment
Share on other sites

BASE_URL should probably look like the original one, ie a host name.

 

Again, I am developing locally on my laptop.

 

There is no web URL...

 

That is why I am asking how to set it up locally and point it to my Web Root.

 

 

 

TomTees

 

 

Link to comment
Share on other sites

Try these settings:

 

	// Constants
define('BASE_URI', '/01_KnowledgeIsPower/');
define('BASE_URL', 'localhost');
define('MYSQL', '/includes/mysql.inc.php');

 

It's a bit tricky to know what they're expecting there, as those are not what I would normally consider a URI or URL.  So instead I'm trying to go based on the example values.

Link to comment
Share on other sites

Try these settings:

 

	// Constants
define('BASE_URI', '/01_KnowledgeIsPower/');
define('BASE_URL', 'localhost');
define('MYSQL', '/includes/mysql.inc.php');

 

It's a bit tricky to know what they're expecting there, as those are not what I would normally consider a URI or URL.  So instead I'm trying to go based on the example values.

 

What they are expecting was documented in my original post.

 

I tried your idea above but it doesn't seem to work.

 

config.inc.php

define('BASE_URL', 'localhost');

 

 

index.php

<?php
include (BASE_URL . '/includes/footer.html');
?>

 

 

Yields this error...

Warning: include(localhost/includes/footer.html) [function.include]: failed to open stream: No such file or directory in /Users/user1/Documents/DEV/++htdocs/01_KnowledgeIsPower/index.php on line 23

Call Stack

# Time Memory Function Location

1 0.0012 56064 {main}( ) ../index.php:0

 

 

TomTees

 

 

Link to comment
Share on other sites

You shouldn't be including files via urls, you include files via the file system path to that file.

 

Your going to need to provide more information about what the settings should be, the examples are not helping because obviously they aren't correct and the names of the constants aren't exactly meaningful.

Link to comment
Share on other sites

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.