The base URL is returned by this function.
[php]echo base_url();//default
echo base_url (“css/logo.png″);//call image or file in another folder[/php]
The site URL is returned by this function.
[php]echo site_url();
//output - http://localhost/codeigniter/index.php [/php]
The present URL full path is returned by this function.
[php]echo current_url();//output - http://localhost/codeigniter/[/php]
Standard HTML anchor link is created by this function on the local site URL.It has three parameters text,uri segments and attributes.
[php]// Syntax for anchor.
anchor(uri segments, text, attributes);
echo anchor(http://localhost/codeigniter/index.php/home/, 'Click Here', 'title="This is anchor"');
//output
<a href="http://localhost/codeigniter_url_helper/index.php/home" title="This is anchor"> Click Here</a>[/php]
A popup is created in a new window by this function.
[php]anchor_popup(uri segments, text, attributes);
$atts = array(
'width' => '800',
'height' => '600',
'scrollbars' => 'yes',
'status' => 'yes',
'resizable' => 'yes',
'screenx' => '0',
'screeny' => '0'
);
echo anchor_popup(http://localhost/codeigniter/index.php/home, 'Anchor popup', $attributes ); [/php]
Email can be sent directly from a script using this function and it can be visible in view source. A standard output with HTML tag appears.
[php]echo mailto('me@my-site.com', 'Click Here to Contact Me');
//output
<a href="mailto:me@my-site.com">Click Here to Contact Me</a>[/php]
Emails can be sent by encoding it as a link address to avoid spam bots.
[php]echo safe_mailto('me@my-site.com', 'Click Here to Contact Me');[/php]
This function will convert the Emails and URL's into links.
[php]$string = auto_link($string);
echo auto_link("http://www.splessons.com");
$string = auto_link($string, 'url');//Converts only URLs[/php]
This function adds 'http://' in the front of website url.
[php]$url = "splessons.com";
echo prep_url($url);
http://splessons.com //output[/php]
The function moves the given url to specified location.