Posts Tagged ‘uri’

Using url_title() with Spanish or other strange characters

Posted in Snippets Ideas on March 14th, 2010 by admin – 3 Comments

If you are running your site in Spanish and using url_title to create Permalinks in CodeIgniter then likely you had run in character issues while creating your links.

Martin posted a solution in CodeIgniter’s forum with a workaround for this issue. He proposed


$trans = array(
                    $search                                => $replace,
                    "á"                                    => 'a',
                    "é"                                    => 'e',
                    "í"                                    => 'i',
                    "ó"                                    => 'o',
                    "ú"                                    => 'u',
                    "à"                                    => 'a',
                    "è"                                    => 'e',
                    "ì"                                    => 'i',
                    "ò"                                    => 'o',
                    "ù"                                    => 'u',
                    "ñ"                                    => 'n',
                    "ä"                                    => 'a',
                    "ë"                                    => 'e',
                    "ï"                                    => 'i',
                    "ö"                                    => 'o',
                    "ü"                                    => 'u',
                    "\s+"                                => $replace,
                    "[^a-z0-9".$replace."]"                => '',
                    $replace."+"                        => $replace,
                    $replace."$"                        => '',
                    "^".$replace                        => ''
                   );

My two cents here are the following. You can try to override the URL Helper by extending it in MY_url_helper.php under application/helpers directory.

Related searches:

  • codeigniter url_title
  • codeigniter url_title utf8
  • url_title codeigniter
  • codeigniter url_title javascript
  • url_title()
  • url_title javascript
  • url_title codeigniter utf-8
  • php utf8 url_title
  • codeigniter url_title() javascript
  • arabic url_title() codeigniter

How to submit a page to the same controller in CodeIgniter

Posted in Snippets Ideas on July 17th, 2009 by admin – 2 Comments

Imagine you have a view with a <FORM> that need to submit to the same controller class. Probably you don’t want to hardcode the action attribute of your form nor leaving it in blank.

Using PHP_SELF could be a possible approach. However, since $_SERVER[‘PHP_SELF’] is a PHP server variable (nothing to do with CodeIgniter), you may encounter some problems with different environments.

So, why not to use the built-in CodeIgniter URI library? My solution to this problem is the following. Use $this->uri->uri_string() in conjunction with site_url().

Here is a simple example:



Related searches:

  • codeigniter submit
  • codeigniter submit controller view
  • codeigniter $server[\php_self\]
  • submit codeigniter
  • how to resubmit the page to the same controller
  • controller in same page codeigniter
  • codeigniter submit to same page
  • codeigniter submit to different controller
  • codeigniter form helper submit to same page
  • codeigniter $_server[php_self