How can I make a src link to somehting ina folder without adding in the current url of the page in hard code?
Example:
<img src="/images/tomato.jpg" /> in the code should come out as:
<img src="www.example.com/afolder/images/tomato.jpg" /> when viewed on the www.example.com/afolder/index.html page
Is it possible to do this with just HTML? If not, is it possible with PHP?
When a path begins with
/, it’s relative to the root directory of the web site. If it does not begin with a/, the path is relative to the current page’s path (unless you’ve overridden that with a<base>tag). So in your case, simply making the path not root relative by dropping the leading/will solve your problem.