I've discovered that any time I do the following:
echo '<a href="http://" title="bla">huzzah</a>';
I end up with the following being rendered to the browser:
<a href="http:///" title="bla">huzzah</a>
This is particularly annoying when I link to a file with an extension, as it breaks the link.
Any ideas why this is happening and how I can fix it?
Thanks
Update: For those asking about my exact implementation, here it is. In my troubleshooting I've dumbed it down as much as I could, so please don't mind where I concat plain text to plaintext...
function print_it($item) {
echo '<div class="listItem clearfix">';
echo '<div class="info">';
echo '<span class="title">';
if(isset($item[6])) {
echo '<a href="http://" title="">' . 'me' . '</a>';
}
echo '</span>';
echo '</div></div>';
}
Update: In response to Matt Long, I pasted in your line and it rendered the same.
Update: In response to Fire Lancer, I've put back in my original attempt, and will show you both below.
echo substr($item[6],13) . '<br>';
echo '<a href="http://' . substr($item[6],13) . '" title="' . $item[0] . '">' . $item[0] . '</a>';
<span class="title">www.edu.gov.on.ca%2Feng%2Ftcu%2Fetlanding.html<br>
<a href="http://www.edu.gov.on.ca%2Feng%2Ftcu%2Fetlanding.html" title="Employment Ontario">Employment Ontario</a></span>
The reason for the substr'ing is due to the URL being run through rawurlencode() elsewhere, and linking to http%3A%2F%2F makes the page think it is a local/relative link.
Update: I pasted the above response without really looking at it. So the HTML is correct when viewing source, but the actual page interprets it with another trailing slash after it.
Solution: This was all a result of rawlurlencode(). If I decoded, or skipped the encoding all together, everything worked perfectly. Something about rawurlencode() makes the browser want to stick a trailing slash in there.
Thanks to everyone for your help. I would vote you up, but apparently I need a higher rep to do that.