I'm using CodeIgniter (because it's awesome) and I have something like:
<?php echo anchor("/", "whatever.com" ); ?>
However, this results in http://www.whatever.com/.html which is not right. Help?
I'm using CodeIgniter (because it's awesome) and I have something like:
<?php echo anchor("/", "whatever.com" ); ?>
However, this results in http://www.whatever.com/.html which is not right. Help?
Is there any reason why you are using the anchor? It's purpose is to help you create anchors for your site, not really for external sites. If you are linking to an external site, just create a regular link?
The anchor helper parameters are
anchor(uri segments, text, attributes)
It has added .html to the end because you have a url_suffix in your config. As Wil says, anchor is not really meant for external sites.
If you want to use the anchor function in CodeIgniter to link to an external site you must include the protocol part of the URL. So if you want to link to www.whatever.com you must write
anchor('http://www.whatever.com', 'The site name');
If you don't include the protocol part of the URL, CodeIgniter will think you mean an internal link and will create a link relative to the base URL of your site.
Digging into the CodeIgniter URL helper code you find
$site_url = ( ! preg_match('!^\w+://! i', $uri)) ? site_url($uri) : $uri;
www.whatever.com is not matching the regular expression so you are getting an anchor with a URL relative to the site's base URL.