Skip to content

Instantly share code, notes, and snippets.

@janogarcia
Created January 9, 2012 12:54
Show Gist options
  • Save janogarcia/1582828 to your computer and use it in GitHub Desktop.
Save janogarcia/1582828 to your computer and use it in GitHub Desktop.
url_title_i18n(): multilanguage version of CodeIgniter url_title() fucntion. #i18n #internationalization #language
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
* Create URL Title with support for accented characters
*
* Takes a "title" string as input and creates a
* human-friendly URL string with either a dash
* or an underscore as the word separator.
*
* All accented characters get transliterated
* via the the convert_accented_characters() function
* which relies on the mapping provided by application/config/foreign_chars.php
*
* @access public
* @param string the string
* @param string the separator: dash, or underscore
* @return string
*/
if ( ! function_exists('url_title_i18n'))
{
function url_title_i18n($str, $separator = 'dash', $lowercase = FALSE)
{
$CI =& get_instance();
$CI->load->helper('text');
return url_title(convert_accented_characters($str), $separator, $lowercase);
}
}
/* End of file MY_url_helper.php */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment