From 8acc6f679d8343b168c0661a18be20be9ec6316e Mon Sep 17 00:00:00 2001 From: Derek Allard Date: Sun, 2 Dec 2007 15:01:55 +0000 Subject: Fixed an example for XML RPC. Fixed a missing "?>" in the smiley helper. --- user_guide/helpers/smiley_helper.html | 204 +--------------------------------- 1 file changed, 1 insertion(+), 203 deletions(-) (limited to 'user_guide/helpers/smiley_helper.html') diff --git a/user_guide/helpers/smiley_helper.html b/user_guide/helpers/smiley_helper.html index ad7469981..715c3df4f 100644 --- a/user_guide/helpers/smiley_helper.html +++ b/user_guide/helpers/smiley_helper.html @@ -1,203 +1 @@ - - - - -CodeIgniter User Guide : Smiley Helper - - - - - - - - - - - - - - - - - - - - - - -
- - - - - -

CodeIgniter User Guide Version 1.5.4

-
- - - - - - - - - -
- - -
- - - -
- - -

Smiley Helper

- -

The Smiley Helper file contains functions that let you manage smileys (emoticons).

- - -

Loading this Helper

- -

This helper is loaded using the following code:

-$this->load->helper('smiley'); - -

Overview

- -

The Smiley helper has a renderer that takes plain text simileys, like :-) and turns -them into a image representation, like smile!

- -

It also lets you display a set of smiley images that when clicked will be inserted into a form field. -For example, if you have a blog that allows user commenting you can show the smileys next to the comment form. -Your users can click a desired smiley and with the help of some JavaScript it will be placed into the form field.

- - - -

Clickable Smileys Tutorial

- -

Here is an example demonstrating how you might create a set of clickable smileys next to a form field. This example -requires that you first download and install the smiley images, then create a controller and the View as described.

- -

Important: Before you begin, please download the smiley images and put them in -a publicly accessible place on your server. This helper also assumes you have the smiley replacement array located at -application/config/smileys.php

- - -

The Controller

- -

In your application/controllers/ folder, create a file called smileys.php and place the code below in it.

- -

Important: Change the URL in the get_clickable_smileys() function below so that it points to -your smiley folder.

- -

You'll notice that in addition to the smiley helper we are using the Table Class.

- - - -

In your application/views/ folder, create a file called smiley_view.php and place this code in it:

- - - - - -

When you have created the above controller and view, load it by visiting http://www.your=site.com/index.php/smileys/

- -

Function Reference

- - -

get_clickable_smileys()

- -

Returns an array containing your smiley images wrapped in a cliackable link. You must supply the URL to your smiley folder -via the first parameter:

- -$image_array = get_clickable_smileys("http://www.your-site.com/images/smileys/"); - - -

js_insert_smiley()

- -

Generates the JavaScript that allows the images to be clicked and inserted into a form field. -The first parameter must contain the name of your form, the second parameter must contain the name of the -form field. This function is designed to be placed into the <head> area of your web page.

- -<?php echo js_insert_smiley('blog', 'comments'); ?> - - -

parse_smileys()

- -

Takes a string of text as input and replaces any contained plain text smileys into the image -equivalent. The first parameter must contain your string, the second must contain the the URL to your smiley folder:

- - - -$str = 'Here are some simileys: :-) ;-)'; - -$str = parse_smileys($str, "http://www.your-site.com/images/smileys/"); - -echo $str; - -
- - - - - - - \ No newline at end of file + CodeIgniter User Guide : Smiley Helper

CodeIgniter User Guide Version 1.5.4


Smiley Helper

The Smiley Helper file contains functions that let you manage smileys (emoticons).

Loading this Helper

This helper is loaded using the following code:

$this->load->helper('smiley');

Overview

The Smiley helper has a renderer that takes plain text simileys, like :-) and turns them into a image representation, like smile!

It also lets you display a set of smiley images that when clicked will be inserted into a form field. For example, if you have a blog that allows user commenting you can show the smileys next to the comment form. Your users can click a desired smiley and with the help of some JavaScript it will be placed into the form field.

Clickable Smileys Tutorial

Here is an example demonstrating how you might create a set of clickable smileys next to a form field. This example requires that you first download and install the smiley images, then create a controller and the View as described.

Important: Before you begin, please download the smiley images and put them in a publicly accessible place on your server. This helper also assumes you have the smiley replacement array located at application/config/smileys.php

The Controller

In your application/controllers/ folder, create a file called smileys.php and place the code below in it.

Important: Change the URL in the get_clickable_smileys() function below so that it points to your smiley folder.

You'll notice that in addition to the smiley helper we are using the Table Class.

In your application/views/ folder, create a file called smiley_view.php and place this code in it:

When you have created the above controller and view, load it by visiting http://www.your=site.com/index.php/smileys/

Function Reference

get_clickable_smileys()

Returns an array containing your smiley images wrapped in a cliackable link. You must supply the URL to your smiley folder via the first parameter:

$image_array = get_clickable_smileys("http://www.your-site.com/images/smileys/");

js_insert_smiley()

Generates the JavaScript that allows the images to be clicked and inserted into a form field. The first parameter must contain the name of your form, the second parameter must contain the name of the form field. This function is designed to be placed into the <head> area of your web page.

<?php echo js_insert_smiley('blog', 'comments'); ?>

parse_smileys()

Takes a string of text as input and replaces any contained plain text smileys into the image equivalent. The first parameter must contain your string, the second must contain the the URL to your smiley folder:

$str = 'Here are some simileys: :-) ;-)'; $str = parse_smileys($str, "http://www.your-site.com/images/smileys/"); echo $str;
\ No newline at end of file -- cgit v1.2.3-24-g4f1b