This Question is Not Answered

1 "correct" answer available (4 pts) 2 "helpful" answers available (2 pts)
2 Replies Last post: Oct 3, 2013 4:32 PM by John Wales  
John Wales Newbie 16 posts since
Oct 10, 2012
Currently Being Moderated

Oct 3, 2013 4:24 AM

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!

Andriy Bazanov Master 3,968 posts since
May 28, 2010
Currently Being Moderated
Oct 3, 2013 12:54 PM in response to: John Wales
Re: Intellisense on path when using defined constants

Hi there,

 

Have you considered using <base> HTML tag?

 

http://www.w3schools.com/tags/tag_base.asp

More Like This

  • Retrieving data ...