From 1ea127ae8a8026af7679526af06ff297d5104104 Mon Sep 17 00:00:00 2001 From: Derek Allard Date: Fri, 4 Apr 2008 12:26:46 +0000 Subject: doc fixes --- user_guide/general/helpers.html | 5 +- user_guide/general/hooks.html | 59 +++++----------- user_guide/helpers/index.html | 126 ---------------------------------- user_guide/helpers/smiley_helper.html | 8 +-- user_guide/libraries/zip.html | 4 +- 5 files changed, 27 insertions(+), 175 deletions(-) delete mode 100644 user_guide/helpers/index.html diff --git a/user_guide/general/helpers.html b/user_guide/general/helpers.html index 063ef720c..5569d9834 100644 --- a/user_guide/general/helpers.html +++ b/user_guide/general/helpers.html @@ -69,8 +69,7 @@ Each helper function performs one specific task, with no dependence on other fun

CodeIgniter does not load Helper Files by default, so the first step in using a Helper is to load it. Once loaded, it becomes globally available in your controller and views.

-

Helpers are typically stored in your system/helpers directory. Alternately you can create a folder called helpers inside -your application folder and store them there. CodeIgniter will look first in your system/application/helpers +

Helpers are typically stored in your system/helpers, or system/application/helpers directory. CodeIgniter will look first in your system/application/helpers directory. If the directory does not exist or the specified helper is not located there CI will instead look in your global system/helpers folder.

@@ -149,7 +148,7 @@ function any_in_array($needle, $haystack)
function random_element($array)
{
    shuffle($array);
-    return array_pop();
+    return array_pop($array);
}
diff --git a/user_guide/general/hooks.html b/user_guide/general/hooks.html index 14e28d47f..11acc043e 100644 --- a/user_guide/general/hooks.html +++ b/user_guide/general/hooks.html @@ -122,7 +122,7 @@ $hook['pre_controller'][] = array(
$hook['pre_controller'][] -

This permits you to the same hook point with multiple scripts. The order you define your array will be the execution order.

+

This permits you to have the same hook point with multiple scripts. The order you define your array will be the execution order.

Hook Points

@@ -130,45 +130,24 @@ $hook['pre_controller'][] = array(

The following is a list of available hook points.

- - - - - - - - - - - +
  • pre_system
    + Called very early during system execution. Only the benchmark and hooks class have been loaded at this point. No routing or other processes have happened.
  • +
  • pre_controller
    + Called immediately prior to any of your controllers being called. All base classes, routing, and security checks have been done.
  • +
  • post_controller_constructor
    + Called immediately after your controller is instantiated, but prior to any method calls happening.
  • +
  • post_controller
    + Called immediately after your controller is fully executed.
  • +
  • display_override
    + Overrides the _display() function, used to send the finalized page to the web browser at the end of system execution. This permits you to + use your own display methodology. Note that the finalized data will be available by calling $this->output->get_output()
  • +
  • cache_override
    + Enables you to call your own function instead of the _display_cache() function in the output class. This permits you to use your own cache display mechanism.
  • +
  • scaffolding_override
    + Permits a scaffolding request to trigger your own script instead.
  • +
  • post_system
    + Called after the final rendered page is sent to the browser, at the end of system execution after the finalized data is sent to the browser.
  • + diff --git a/user_guide/helpers/index.html b/user_guide/helpers/index.html deleted file mode 100644 index c46ac0487..000000000 --- a/user_guide/helpers/index.html +++ /dev/null @@ -1,126 +0,0 @@ - - - - -CodeIgniter User Guide : Helper Functions - - - - - - - - - - - - - - - - - - - - - - -
    - - - - - -

    CodeIgniter User Guide Version 1.6.1

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

    Helper Functions

    - -

    Helpers, as the name suggests, help you with tasks. Each helper file is simply a collection of functions in a particular -category. There are URL Helpers, that assist in creating links, there are Form Helpers -that help you create form elements, Text Helpers perform various text formatting routines, -Cookie Helpers set and read cookies, File Helpers help you deal with files, etc. -

    - -

    Unlike most other systems in CodeIgniter, Helpers are not written in an Object Oriented format. They are simple, procedural functions. -Each helper function performs one specific task, with no dependence on other functions.

    - -

    Helpers are intentionally kept very simple so that they can be used within your View Files with a minimal amount of code. -This is important if you intend to have designers or non-programmer will be working with your view files, since it keeps the code to a minimum. -

    - -

    CodeIgniter does not load Helper Files by default, so the first step in using -a Helper is to load it. Once loaded, it becomes globally available in your controller and views.

    - -

    Loading a Helper

    - -

    Loading a helper file is quite simple using the following function:

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

    Where name is the file name of the helper, without the .php file extension or the "helper" part.

    - -

    For example, to load the URL Helper file, which is named url_helper.php, you would do this:

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

    A helper can be loaded anywhere within your controller functions (or even within your View files, although that's not a good practice), -as long as you load it before you use it. You can load your helpers in your controller constructor so that they become available -automatically in any function, or you can load a helper in a specific function that needs it.

    - -

    Note: The Helper loading function above does not return a value, so don't try to assign it to a variable. Just use it as shown.

    - -

    Auto-loading Helpers

    - -

    If you find that you need a particular helper globally throughout your application, you can tell CodeIgniter to auto-load it during system initialization. -This is done by opening the application/config/autoload.php file and adding the helper to the autoload array.

    - - -

    Using a Helper

    - -

    Once you've loaded the Helper File containing the function you intend to use, you'll call it the way you would a standard PHP function.

    - -

    For example, to create a link using the anchor() function in one of your view files you would do this:

    - -<?=anchor('blog/comments', 'Click Here');?> - -

    Where "Click Here" is the name of the link, and "blog/comments" is the URI to the controller/function you wish to link to.

    - - -

    Now What?

    - -

    In the Table of Contents you'll find a list of all the available Helper Files. Browse each one to see what they do.

    - - -
    - - - - - - - \ No newline at end of file diff --git a/user_guide/helpers/smiley_helper.html b/user_guide/helpers/smiley_helper.html index 15f9de066..7829f461b 100644 --- a/user_guide/helpers/smiley_helper.html +++ b/user_guide/helpers/smiley_helper.html @@ -97,7 +97,7 @@ 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:

    @@ -157,7 +157,7 @@ class Smileys extends Controller {

    get_clickable_smileys()

    -

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

    Returns an array containing your smiley images wrapped in a clickable 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/"); @@ -175,7 +175,7 @@ form field. This function is designed to be placed into the <head> area of

    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:

    +equivalent. The first parameter must contain your string, the second must contain the URL to your smiley folder:

    diff --git a/user_guide/libraries/zip.html b/user_guide/libraries/zip.html index 484bbac64..7ee4d7be3 100644 --- a/user_guide/libraries/zip.html +++ b/user_guide/libraries/zip.html @@ -159,7 +159,7 @@ $this->zip->read_file($path); $this->zip->download('my_backup.zip'); -

    If you would like the Zip archive to maintain the directory structure the file is in, pass TRUE (boolean) in the +

    If you would like the Zip archive to maintain the directory structure of the file in it, pass TRUE (boolean) in the second parameter. Example:

    @@ -202,7 +202,7 @@ directory is writable (666 or 777 is usually OK). Example:

    $this->zip->download()

    -

    Causes the Zip file to be downloaded to your server. The function must be passed the name you would like the zip file called. +

    Causes the Zip file to be downloaded from your server. The function must be passed the name you would like the zip file called. Example:

    $this->zip->download('latest_stuff.zip'); // File will be named "latest_stuff.zip" -- cgit v1.2.3-24-g4f1b