I am rewriting my website, changing it over from ColdFusion to PHP. While I am making the changes and testing I am using a subfolder under my son’s domain name. I have encountered a problem that I have seen before, but I have been able to fix it before by putting a couple of .. or / in front of the path.
While testing I have discovered that some of these paths work and some don’t; it seems a bit random. So, it makes it a little difficult to test and in fact on one of the pages I’m working on I cannot get the path to work at all unless I put the complete path. However, that would defeat the purpose of using databases.
(And yes, the PHP variable is working.)
Does anyone know of a sure fix?
<img src="..$ArtFilePath" title="$Title" alt="$Title">
<img src="/$ArtFilePath" title="$Title" alt="$Title">
<img src="/PHP2012/$ArtFilePath" title="$Title" alt="$Title">
<img src="http://markdinwiddie.com/PHP2012/artwork/Drawings/Boy.jpg" title="$Title" alt="$Title">
I am not quite sure what you want, but you can have something like:
That would have the ‘http://markdinwiddie.com/PHP2012/’ part of the URL already in place and you can then use variables from your database to fill the other sections of the link. (With $variable being one section of the URL and and $anothervariable being the second part of the URL.
This would echo: (provided $variable=hi123, $anothervariable=two2, and $title=tilt)
Hope that answers your question (or at least helps).