xml_convert()

xml_convert($str[, $protect_all = FALSE]) Parameters: $str (string) – the text string to convert $protect_all (bool) – Whether to protect all content that looks like a potential entity instead of just numbered entities, e.g. &foo; Returns: XML-converted string Return type: string Takes a string as input and converts the following reserved XML characters to entities: Ampersands: & Less than and greater than characters: < > Single and double quotes: ‘ “ Dashes: - This

xss_clean()

xss_clean($str[, $is_image = FALSE]) Parameters: $str (string) – Input data $is_image (bool) – Whether we’re dealing with an image Returns: XSS-clean string Return type: string Provides Cross Site Script Hack filtering. This function is an alias for CI_Input::xss_clean(). For more info, please see the Input Library documentation.

Web Page Caching

CodeIgniter lets you cache your pages in order to achieve maximum performance. Although CodeIgniter is quite fast, the amount of dynamic information you display in your pages will correlate directly to the server resources, memory, and processing cycles utilized, which affect your page load speeds. By caching your pages, since they are saved in their fully rendered state, you can achieve performance that nears that of static web pages. How Does Caching Work? Caching can be enabled on a per-page

word_limiter()

word_limiter($str[, $limit = 100[, $end_char = '…']]) Parameters: $str (string) – Input string $limit (int) – Limit $end_char (string) – End character (usually an ellipsis) Returns: Word-limited string Return type: string Truncates a string to the number of words specified. Example: $string = "Here is a nice text string consisting of eleven words."; $string = word_limiter($string, 4); // Returns: Here is a nice The third parameter is an optional suffix added to the string. By de

word_censor()

word_censor($str, $censored[, $replacement = '']) Parameters: $str (string) – Input string $censored (array) – List of bad words to censor $replacement (string) – What to replace bad words with Returns: Censored string Return type: string Enables you to censor words within a text string. The first parameter will contain the original string. The second will contain an array of words which you disallow. The third (optional) parameter can contain a replacement value for the words. If

word_wrap()

word_wrap($str[, $charlim = 76]) Parameters: $str (string) – Input string $charlim (int) – Character limit Returns: Word-wrapped string Return type: string Wraps text at the specified character count while maintaining complete words. Example: $string = "Here is a simple string of text that will help us demonstrate this function."; echo word_wrap($string, 25); // Would produce: // Here is a simple string // of text that will help us // demonstrate this // function.

write_file()

write_file($path, $data[, $mode = 'wb']) Parameters: $path (string) – File path $data (string) – Data to write to file $mode (string) – fopen() mode Returns: TRUE if the write was successful, FALSE in case of an error Return type: bool Writes data to the file specified in the path. If the file does not exist then the function will create it. Example: $data = 'Some file data'; if ( ! write_file('./path/to/file.php', $data)) { echo 'Unable to write the file'; } else {

Using CodeIgniter Libraries

All of the available libraries are located in your system/libraries/ directory. In most cases, to use one of these classes involves initializing it within a controller using the following initialization method: $this->load->library('class_name'); Where ‘class_name’ is the name of the class you want to invoke. For example, to load the Form Validation Library you would do this: $this->load->library('form_validation'); Once initialized you can use it as indicated in the user guide pa

valid_email()

valid_email($email) Parameters: $email (string) – E-mail address Returns: TRUE if a valid email is supplied, FALSE otherwise Return type: bool Checks if the input is a correctly formatted e-mail address. Note that is doesn’t actually prove that the address will be able recieve mail, but simply that it is a validly formed address. Example: if (valid_email('[email protected]')) { echo 'email is valid'; } else { echo 'email is not valid'; } Note All that this function

Views

A view is simply a web page, or a page fragment, like a header, footer, sidebar, etc. In fact, views can flexibly be embedded within other views (within other views, etc., etc.) if you need this type of hierarchy. Views are never called directly, they must be loaded by a controller. Remember that in an MVC framework, the Controller acts as the traffic cop, so it is responsible for fetching a particular view. If you have not read the Controllers page you should do so before continuing. Using the