From ee0a7f0083e9e3e2e667211acd3909e71aa1ec47 Mon Sep 17 00:00:00 2001 From: Derek Allard Date: Thu, 8 May 2008 13:59:27 +0000 Subject: Added a Reserved Names page to the userguide, and migrated reserved controller names into it. Added a Common Functions page to the userguide for globally available functions. --- user_guide/changelog.html | 7 ++ user_guide/general/autoloader.html | 3 +- user_guide/general/common_functions.html | 90 ++++++++++++++++++ user_guide/general/controllers.html | 50 +--------- user_guide/general/reserved_names.html | 151 +++++++++++++++++++++++++++++++ user_guide/general/scaffolding.html | 8 +- user_guide/general/urls.html | 3 +- user_guide/helpers/file_helper.html | 9 +- user_guide/nav/nav.js | 2 + user_guide/toc.html | 2 + 10 files changed, 266 insertions(+), 59 deletions(-) create mode 100644 user_guide/general/common_functions.html create mode 100644 user_guide/general/reserved_names.html diff --git a/user_guide/changelog.html b/user_guide/changelog.html index 6521636b6..07637db08 100644 --- a/user_guide/changelog.html +++ b/user_guide/changelog.html @@ -105,6 +105,13 @@ SVN Commit: not currently released

  • Modified captcha generation to first look for the function imagecreatetruecolor, and fallback to imagecreate if it isn't available (#4226).
  • +
  • Other + Changes + +
  • Bugfixes for 1.6.2

    diff --git a/user_guide/general/autoloader.html b/user_guide/general/autoloader.html index b75a71d19..3456fba2a 100644 --- a/user_guide/general/autoloader.html +++ b/user_guide/general/autoloader.html @@ -93,8 +93,7 @@ Previous Topic:  Hooks - Extending the Core    ·   Top of Page   ·   User Guide Home   ·   -Next Topic:  Scaffolding -

    +Next Topic:  Common Functions

    CodeIgniter  ·  Copyright © 2006-2008  ·  Ellislab, Inc.

    diff --git a/user_guide/general/common_functions.html b/user_guide/general/common_functions.html new file mode 100644 index 000000000..e7cf9e068 --- /dev/null +++ b/user_guide/general/common_functions.html @@ -0,0 +1,90 @@ + + + + +Common Functions : CodeIgniter User Guide + + + + + + + + + + + + + + + + + + + + + + +
    + + + + + +

    CodeIgniter User Guide Version 1.6.2

    +
    + + + + + + + + + +
    + + +
    + + + +
    + +

    Common Functions

    + +

    CodeIgniter uses a few functions for its operation that are globally defined, and are available to you at any point. These do not require loading any libraries or helpers.

    +

    is_really_writable('path/to/file')

    +

    is_writable() returns TRUE on Windows servers when you really can't write to the file as the OS reports to PHP as FALSE only if the read-only attribute is marked. This function determines if a file is actually writable by attempting to write to it first. Generally only recommended on platforms where this information may be unreliable.

    +if (is_really_writable('file.txt'))
    +{
    +      echo "I could write to this if I wanted to";
    +}
    +else
    +{
    +      echo "File is not writable";
    +}
    +

    config_item('item_key')

    +

    The Config library is the preferred way of accessing configuration information, however config_item() can be used to retrieve single keys. See Config library documentation for more information.

    +

    show_error('message'), show_404('page'), log_message('level', 'message')

    +

    These are each outlined on the Error Handling page.

    +
    + + + + + + + \ No newline at end of file diff --git a/user_guide/general/controllers.html b/user_guide/general/controllers.html index 2dac6e0d7..4c0c506af 100644 --- a/user_guide/general/controllers.html +++ b/user_guide/general/controllers.html @@ -359,50 +359,7 @@ Constructors can't return a value, but they can do some default work.

    Since your controller classes will extend the main application controller you must be careful not to name your functions identically to the ones used by that class, otherwise your local functions -will override them. The following -is a list of reserved names. Do not name your controller functions any of these:

    - - - -


    If you are running PHP 4 there are some additional reserved names. These ONLY apply if you are running PHP 4.

    - - - - - - - +will override them. See Reserved Names for a full list.

    That's it!

    @@ -416,12 +373,11 @@ is a list of reserved names. Do not name your controller functions any of these diff --git a/user_guide/general/reserved_names.html b/user_guide/general/reserved_names.html new file mode 100644 index 000000000..60bdec2fc --- /dev/null +++ b/user_guide/general/reserved_names.html @@ -0,0 +1,151 @@ + + + + +Reserved Names : CodeIgniter User Guide + + + + + + + + + + + + + + + + + + + + + + +
    + + + + + +

    CodeIgniter User Guide Version 1.6.2

    +
    + + + + + + + + + +
    + + +
    + + + +
    + +

    Reserved Names

    + +

    In order to help out, CodeIgniter uses a series of functions and names in its operation. Because of this, some names cannot be used by a developer. Following is a list of reserved names that cannot be used.

    +

    Controller names

    +

    Since your controller classes will extend the main application controller you +must be careful not to name your functions identically to the ones used by that class, otherwise your local functions +will override them. The following +is a list of reserved names. Do not name your controller functions any of these:

    + +


    + If you are running PHP 4 there are some additional reserved names. These ONLY apply if you are running PHP 4.

    + +

    Functions

    + +

    Variables

    + +

    Constants

    + +
    + + + + + + + \ No newline at end of file diff --git a/user_guide/general/scaffolding.html b/user_guide/general/scaffolding.html index 764e3b4cf..7dc66d1d8 100644 --- a/user_guide/general/scaffolding.html +++ b/user_guide/general/scaffolding.html @@ -104,7 +104,7 @@ class Blog extends Controller {
           function Blog()
           {
                parent::Controller();

    -            $this->load->scaffolding('table_name');
    +            $this->load->scaffolding('table_name');
           }
    }
    ?> @@ -135,12 +135,10 @@ database functions.

    diff --git a/user_guide/general/urls.html b/user_guide/general/urls.html index 9902083fa..8ba46e3d8 100644 --- a/user_guide/general/urls.html +++ b/user_guide/general/urls.html @@ -145,8 +145,7 @@ Previous Topic:  Getting Started    ·   Top of Page   ·   User Guide Home   ·   -Next Topic:  Controllers -

    +Next Topic:  Reserved Names

    CodeIgniter  ·  Copyright © 2006-2008  ·  Ellislab, Inc.

    diff --git a/user_guide/helpers/file_helper.html b/user_guide/helpers/file_helper.html index a88e5dfc9..3fa92462b 100644 --- a/user_guide/helpers/file_helper.html +++ b/user_guide/helpers/file_helper.html @@ -134,11 +134,14 @@ can optionally be added to the file names by setting the second parameter to TRU

    Given a file and path, returns the name, path, size, date modified. Second parameter allows you to explicitly declare what information you want returned; options are: name, server_path, size, date, readable, writable, executable, fileperms. Returns FALSE if the file cannot be found.

    Note: The "writable" uses the PHP function is_writable() which is known to have issues on the IIS webserver. Consider using fileperms instead, which returns information from PHP's fileperms() function.

    -

    get_mime_by_extension('path/to/file/')

    +

    get_mime_by_extension('file')

    Translates a file extension into a mime type based on config/mimes.php. Returns FALSE if it can't determine the type, or open the mime config file.

    - -

    Note: This is not an accurate way of determining file mime types, and is here strictly as a convenience. It should not be used for security.

    +

    +$file = "somefile.png";
    +echo $file . ' is has a mime type of ' . get_mime_by_extension($file);
    +

    +

    Note: This is not an accurate way of determining file mime types, and is here strictly as a convenience. It should not be used for security.

    diff --git a/user_guide/nav/nav.js b/user_guide/nav/nav.js index 88992804f..e82429943 100644 --- a/user_guide/nav/nav.js +++ b/user_guide/nav/nav.js @@ -42,6 +42,7 @@ function create_menu(basepath) '