Welcome Guest, Not a member yet? Register   Sign In
anchor bug
#1

[eluser]codeman[/eluser]
Hi guys,

i was using the anchor tag here for a href link,

Here is my code:
Code:
$this->load->helper('url');
        echo anchor("www.google.com", 'Click Here');


and here is what i get: http://example.com/index.php/www.google.com instead of www.google.com

why is this? How do i fix it?

Thanks,
HP
#2

[eluser]Dam1an[/eluser]
The anchor function is only meant for internal links, you'll have to stick with manualy HTML tags for external links
#3

[eluser]codeman[/eluser]
Cool thanks - But i am still having problem

When i go to my view and view.php file, where i put
Code:
<a href="www.google.com" target="_parent"> Click here now</a>

Still it does not work, it still gives me http://localhost/index.php/product/blog/www.google.com

Why is it happening ,
#4

[eluser]bobbybaboon[/eluser]
try:
Code:
<a href="http://www.google.com" target="_parent"> Click here now</a>

You need to add "http://" before your url. And just so you know, the target attribute has been deprecated so if you're using a strict doctype it won't be valid.
#5

[eluser]codeman[/eluser]
Cool it worked for both in anchor and a href

Thanks,
#6

[eluser]Zeeshan Rasool[/eluser]
Its not some sort of restriction, You can also use anchor for this purpose. :-)

try this..

Code:
&lt;?php echo anchor('http://www.google.com','google');?&gt;

keep going.
#7

[eluser]Dam1an[/eluser]
[quote author="zEsHaN" date="1241084020"]Its not some sort of restriction, You can also use anchor for this purpose. :-)

try this..

Code:
&lt;?php echo anchor('http://www.google.com','google');?&gt;

keep going.[/quote]

Ah, so as long as you have the full prefix its ok?
I thought its main purpose was for internal links which aren't dependant on full paths (aka built on the fly based on base_url)
#8

[eluser]Thorpe Obazee[/eluser]
I actually didn't know that that worked too. Maybe that should be added to the user_guide, no?
#9

[eluser]Zeeshan Rasool[/eluser]
Quote:Ah, so as long as you have the full prefix its ok?
I thought its main purpose was for internal links which aren’t dependant on full paths (aka built on the fly based on base_url)
Its not my wording dude, you can take help from user guid. >Sad

----&gt;read user manul




Theme © iAndrew 2016 - Forum software by © MyBB