I don't think it's going to hit performance issue but illumine a correct path. Since common MVC frameworks I knew would likely separate their public file such assets you mentioned. They are likely going to confuse you in order to fetch the assets according to its prettify-URL's rule. Then comes a const define or any global static method/function to help you grab the correct URL. To help you also to avoid simple mistake like this (notice the /
)
<img src="images/image.jpg">
<img src="/images/image.jpg">
You can always cache it too if you still worry of it existance, since it's static -- surely applicable.
So, if you already get the correct URL/path each time you're going to display your assets without constant Base_url
, then just don't write it down.
If you aware of performance, it's better to use const
language construct, as it is defined in compile time. Or if you're using APC, you can also define it with apc_define_constants
to perform built in opcode caching by APC.