Posts Tagged ‘helpers’

link_tag in CodeIgniter 2.0

Posted in Snippets Ideas on June 2nd, 2011 by admin – Be the first to comment

link_tag is an interesting helper function introduced recently in CodeIgniter that helps you build link HTML tags to include CSS files but also feeds or favicons in a header.

The helper function documentation is quite explanatory and you can see it here.

In particular, if you are planning to use a similar function for Javascript files, please check this forum post. A custom helper function that helps using the same approach but for JS files instead.

But if you want to go one step ahead, also notice that you can get a performance improvement by combining external resources in one single file. In CodeIgniter you can also do that, for example using the approach to combine JS and CSS files.

Related searches:

  • codeigniter link_tag
  • link_tag codeigniter & different location
  • link_tag codeigniter
  • link_tag ci
  • codeigniter favicon
  • link_tag
  • link_tag in codeigniter
  • link_tag in codeigniter example
  • link_tag javascript codeigniter
  • link_tag() in ci

Gravatars using CodeIgniter

Posted in Snippets Ideas on May 28th, 2010 by admin – Be the first to comment

If you want to display avatar images in your CodeIgniter application, you can use this Gravatar helper that contains a simple function to retrieve the Gravatar image source for a given email.

The Gravatar helper was created by Dave_C as mentioned in Codeigniter Forums.

By using this helper you can easily integrate your application with Gravatars like this:

codeigniter-gravatars

How to use the helper?

Follow the installation steps described here, and then just load the helper as usual and put this code in your view page passing the desired email as first parameter.

<?php echo gravatar( "you@domain.com" ); ?>

Related searches:

  • gravatar codeigniter

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