[eluser]got 2 doodle[/eluser]
extend url helper - create the following file /system/application/helpers/my_url_helper.php
Code:
if (!defined('BASEPATH')) exit('No direct script access allowed');
/**
* Secure Site URL
*
* Create a local URL based on your secure basepath. Segments can be passed via the
* first parameter either as a string or an array.
*
* @access public
* @param string
* @return string
*/
if (! function_exists('secure_site_url'))
{
function secure_site_url($uri = '')
{
$CI =& get_instance();
return $CI->config->secure_site_url($uri);
}
}
// ------------------------------------------------------------------------
/**
* Secure Base URL
*
* Returns the "secure_base_url" item from your config file
*
* @access public
* @return string
*/
if (! function_exists('secure_base_url'))
{
function secure_base_url()
{
$CI =& get_instance();
return $CI->config->slash_item('secure_base_url');
}
}
// ------------------------------------------------------------------------
/**
* Secure Anchor Link
*
* Creates an anchor based on the local URL.
*
* @access public
* @param string the URL
* @param string the link title
* @param mixed any attributes
* @return string
*/
if (! function_exists('secure_anchor'))
{
function secure_anchor($uri = '', $title = '', $attributes = '')
{
$title = (string) $title;
if ( ! is_array($uri))
{
$secure_url = ( ! preg_match('!^\w+://!i', $uri)) ? secure_site_url($uri) : $uri;
}
else
{
$secure_url = secure_site_url($uri);
}
if ($title == '')
{
$title = $secure_url;
}
if ($attributes == '')
{
$attributes = ' title="'.$title.'"';
}
else
{
$attributes = _parse_attributes($attributes);
}
return '<a href="'.$secure_url.'">'.$title.'</a>';
}
}
/**
* Secure Header Redirect
*
* Header redirect in two flavors
*
* @access public
* @param string the URL
* @param string the method: location or redirect
* @return string
*/
if (! function_exists('secure_redirect'))
{
function secure_redirect($uri = '', $method = 'location')
{
switch($method)
{
case 'refresh' : header("Refresh:0;url=".secure_site_url($uri));
break;
default : header("Location: ".secure_site_url($uri));
break;
}
exit;
}
}
continued in next post