Model-View-Controller

CodeIgniter is based on the Model-View-Controller development pattern. MVC is a software approach that separates application logic from presentation. In practice, it permits your web pages to contain minimal scripting since the presentation is separate from the PHP scripting. The Model represents your data structures. Typically your model classes will contain functions that help you retrieve, insert, and update information in your database. The View is the information that is being presented to

meta()

meta([$name = ''[, $content = ''[, $type = 'name'[, $newline = "n"]]]]) Parameters: $name (string) ? Meta name $content (string) ? Meta content $type (string) ? Meta type $newline (string) ? Newline character Returns: HTML meta tag Return type: string Helps you generate meta tags. You can pass strings to the function, or simple arrays, or multidimensional ones. Examples: echo meta('description', 'My Great site'); // Generates: <meta name="description" content="My Great Site"

mysql_to_unix()

mysql_to_unix([$time = '']) Parameters: $time (string) – MySQL timestamp Returns: UNIX timestamp Return type: int Takes a MySQL Timestamp as input and returns it as a UNIX timestamp. Example: $unix = mysql_to_unix('20061124092345');

mdate()

mdate([$datestr = ''[, $time = '']]) Parameters: $datestr (string) – Date string $time (int) – UNIX timestamp Returns: MySQL-formatted date Return type: string This function is identical to PHP’s date() function, except that it lets you use MySQL style date codes, where each code letter is preceded with a percent sign, e.g. %Y %m %d The benefit of doing dates this way is that you don’t have to worry about escaping any characters that are not date codes, as you would normally have t

mb_strpos()

mb_strpos($haystack, $needle[, $offset = 0[, $encoding = NULL]]) Parameters: $haystack (string) – String to search in $needle (string) – Part of string to search for $offset (int) – Search offset $encoding (string) – Character set Returns: Numeric character position of where $needle was found or FALSE if not found Return type: mixed For more information, please refer to the PHP manual for mb_strpos().

local_to_gmt()

local_to_gmt([$time = '']) Parameters: $time (int) – UNIX timestamp Returns: UNIX timestamp Return type: int Takes a UNIX timestamp as input and returns it as GMT. Example: $gmt = local_to_gmt(time());

log_message()

log_message($level, $message) Parameters: $level (string) – Log level: ‘error’, ‘debug’ or ‘info’ $message (string) – Message to log Return type: void This function lets you write messages to your log files. You must supply one of three “levels” in the first parameter, indicating what type of message it is (debug, error, info), with the message itself in the second parameter. Example: if ($some_var == '') { log_message('error', 'Some variable did not contain a value.'); } els

mailto()

mailto($email, $title = '', $attributes = '') Parameters: $email (string) – E-mail address $title (string) – Anchor title $attributes (mixed) – HTML attributes Returns: A “mail to” hyperlink Return type: string Creates a standard HTML e-mail link. Usage example: echo mailto('[email protected]', 'Click Here to Contact Me'); As with the anchor() tab above, you can set attributes using the third parameter: $attributes = array('title' => 'Mail me'); echo mailto('[email protected]'

mb_strlen()

mb_strlen($str[, $encoding = NULL]) Parameters: $str (string) – Input string $encoding (string) – Character set Returns: Number of characters in the input string or FALSE on failure Return type: string For more information, please refer to the PHP manual for mb_strlen().

Managing your Applications

By default it is assumed that you only intend to use CodeIgniter to manage one application, which you will build in your application/ directory. It is possible, however, to have multiple sets of applications that share a single CodeIgniter installation, or even to rename or relocate your application directory. Renaming the Application Directory If you would like to rename your application directory you may do so as long as you open your main index.php file and set its name using the $applicatio