I’m doing a tech site for my education, and I have decided to use the PHP: include function and so the website will be easier to keep. I have not one but two include files:
- head. php (which holds the internet in the < head> tages, the actual header, and the particular horizontal navigation)
- footer. php (which holds the internet in the footer)
My problem is when using the files in sub-folders. Next time i include " scalp. php", the links for the css files, photographs, and other pages are incorrect in addition to won’t work.
I tried when using the direct url to the files. It does work, but I don’t like the thought of having the file urls out for everyone to see inside source code.
Is there a more secure way to achieve this
You requires the full report url’s really, having them comparable won’t reap any benefits for that public. Fact is I can save as on your own page and it will eventually change every url to include the complete URL.
You have to to remember your images will be relative in your file containing your includes. The comprises, for a strategy to think of this, just sort connected with paste the PHP in to your original track.
You can perform: .. /images/background. png as an example. Then it won’t matter whereby folder the PHP was in. Direct URLs might get annoying somethimes, while you switch domains/filenames.
But that’s where aquiring a global config changing like
$site_url = " http: //example. com";
can come in useful. And then when linking to an image, css, js and many others just do like
src=" < = $site_url > /images/logo. jpg"
Ok. Thanks
I do not know what you necessarily mean by " file URLs"…
You possibly can never hide CSS or maybe Javascript files, regardless of you do.
Is what you’re talking about
For anyone who is talking about information like PDF, photographs… those paths and filenames is often hidden.
.