Transactions

CodeIgniter’s database abstraction allows you to use transactions with databases that support transaction-safe table types. In MySQL, you’ll need to be running InnoDB or BDB table types rather than the more common MyISAM. Most other database platforms support transactions natively. If you are not familiar with transactions we recommend you find a good online resource to learn about them for your particular database. The information below assumes you have a basic understanding of transactions. C

trim_slashes()

trim_slashes($str) Parameters: $str (string) – Input string Returns: Slash-trimmed string Return type: string Removes any leading/trailing slashes from a string. Example: $string = "/this/that/theother/"; echo trim_slashes($string); // results in this/that/theother Note This function is DEPRECATED. Use the native trim() instead: | | trim($str, ‘/’);

Tutorial

This tutorial is intended to introduce you to the CodeIgniter framework and the basic principles of MVC architecture. It will show you how a basic CodeIgniter application is constructed in step-by-step fashion. In this tutorial, you will be creating a basic news application. You will begin by writing the code that can load static pages. Next, you will create a news section that reads news items from a database. Finally, you’ll add a form to create news items in the database. This tutorial will

timezone_menu()

timezone_menu([$default = 'UTC'[, $class = ''[, $name = 'timezones'[, $attributes = '']]]]) Parameters: $default (string) – Timezone $class (string) – Class name $name (string) – Menu name $attributes (mixed) – HTML attributes Returns: HTML drop down menu with time zones Return type: string Generates a pull-down menu of timezones, like this one: (UTC -12:00) Baker/Howland Island(UTC -11:00) Samoa Time Zone, Niue(UTC -10:00) Hawaii-Aleutian Standard Time, Cook Islands, Tahiti(UT

timezones()

timezones([$tz = '']) Parameters: $tz (string) – A numeric timezone Returns: Hour difference from UTC Return type: int Takes a timezone reference (for a list of valid timezones, see the “Timezone Reference” below) and returns the number of hours offset from UTC. Example: echo timezones('UM5'); This function is useful when used with timezone_menu().

timespan()

timespan([$seconds = 1[, $time = ''[, $units = '']]]) Parameters: $seconds (int) – Number of seconds $time (string) – UNIX timestamp $units (int) – Number of time units to display Returns: Formatted time difference Return type: string Formats a UNIX timestamp so that is appears similar to this: 1 Year, 10 Months, 2 Weeks, 5 Days, 10 Hours, 16 Minutes The first parameter must contain a UNIX timestamp. The second parameter must contain a timestamp that is greater that the first tim

Static pages

Note: This tutorial assumes you’ve downloaded CodeIgniter and installed the framework in your development environment. The first thing you’re going to do is set up a controller to handle static pages. A controller is simply a class that helps delegate work. It is the glue of your web application. For example, when a call is made to: http://example.com/news/latest/10 We might imagine that there is a controller named “news”. The method being called on news would be “latest”. The news method’s

strip_quotes()

strip_quotes($str) Parameters: $str (string) – Input string Returns: String with quotes stripped Return type: string Removes single and double quotes from a string. Example: $string = "Joe's \"dinner\""; $string = strip_quotes($string); //results in "Joes dinner"

strip_slashes()

strip_slashes($data) Parameters: $data (mixed) – Input string or an array of strings Returns: String(s) with stripped slashes Return type: mixed Removes any slashes from an array of strings. Example: $str = array( 'question'  => 'Is your name O\'reilly?', 'answer' => 'No, my name is O\'connor.' ); $str = strip_slashes($str); The above will return the following array: array( 'question'  => "Is your name O'reilly?", 'answer' => "No, my nam

strip_image_tags()

strip_image_tags($str) Parameters: $str (string) – Input string Returns: The input string with no image tags Return type: string This is a security function that will strip image tags from a string. It leaves the image URL as plain text. Example: $string = strip_image_tags($string); This function is an alias for CI_Security::strip_image_tags(). For more info, please see the Security Library documentation.