Question about Hypelink

Trying to clean up some code during testing…

Way back when, I created a “config.php” file with this Constant…


	// Virtual Location.
	define('BASE_URL', ENVIRONMENT === 'development'
					? 'http://local.debbie'
					: 'http://www.MySite.com');

In the code below, does having BASE_URL provide any value??


		<a class="button2" href="' . BASE_URL . '/account/log-in.php">Log In</a>

If memory serves me right, in this case, I believe I can attain an Absolute Reference in the href by just using a forward slash to start off the Hyperlink URL, right?

The reason why I originally created Constants like WEB_ROOT and BASE_URL was because I had included files that were acting strangely if I didn’t have a way to define some “absolute” point of reference.

It seems to me that isn’t needed here.

Thoughts?

Debbie

I agree that it doesn’t provide any value in that scenario. You could probably find a good portion of those by doing a search for BASE_URL . '/

Anything that starts with a beginning slash, won’t need to have the BASE_URL appended.

See, I am learning, slowly but surely!! :wink:

Thanks cpradio!!

Debbie