Intellisense on path when using defined constants
Hi,
In my projects I am using a config file where I define constants based off whether I am working locally or remotely.
if ($local) {
// Define the constants:
define ('BASE_URL', 'http://192.168.15.3/example.com/');
}
else
{
define ('BASE_URL', 'http://www.example.com/');
}
In my code I use something like this to define the location of a src.
<img src="<?php echo BASE_URL; ?>images/image.jpg" />
This works really well, in the sense that local & remote paths are instantly correct. However I lose intellisense when typing out URL's
What is the best solution? Should I be using a URI type path?
Can I set up multiple 'Resource Roots' on a single project and the intellisense will look in these folders too?
Thanks Community!
请先登录再写评论。
Hi there,
Have you considered using <base> HTML tag?
http://www.w3schools.com/tags/tag_base.asp
Thank you for the reply.
I also have some other constants defined such as BASE_CSS. Will this method work if you want to have multiple bases defined?
I guess just defining the one base tag is still good, no real need to define constants for CSS, JS, IMAGES & BASE_URL.
I will give this a go at work tomorrow.
Cheers!