CodeIgniter view anchor tag prepending host
In my view I'm trying to create an anchor tag but CodeIgniter is prepending my entire host before what I specify as href, therefor making it invalid. I put this
<a href="file://////path_to/file/file.jpg">My File</a>
I get
<a href="http://localhost/index.php/file://////path_to/file/file.jpg">My File<开发者_JS百科/a>
EDIT 3 This is my view, I realise i should not be calling a function in my view but in this case I had little option as something needs to get applied for each data item in the loop, I will try to change this but thats beyond my problem right now. Wesley: I checked the soruce and it displays correctly in the source but in the browser it preappends the host so I guess this has nothing to do with code igniter afterall! How do I make sure it doesn't happen?
<td><?php
$this->ci = &get_instance();
echo $currentData["field_one"] . " - <a href=\"file:://///" . $this->ci->myfunc($currentData["field_one"]); . "\">Log</a>"; ?>
</td>
EDIT 4
my html source
<a href="file:://///\\myhost.local.com\120">
View Log
</a>
my url address bar
http://myhost.local.com/myhostlocal/index.php/level/one/type/b/cc/ee/
the url it goes too when I mouse over the href
http:///myhostlocal/index.php/level/one/type/b/cc/ee/file:://///\\myhost.local.com\120
Looks like the browser is treating "file:://///" as a relative path. Why do you have 2 colons, do you need both? Removing one will provide a valid protocol, and the browser will start treating it as an absolute path.
精彩评论