diff options
author | Daniel Hunsaker <danhunsaker@gmail.com> | 2013-02-22 21:49:33 +0100 |
---|---|---|
committer | Daniel Hunsaker <danhunsaker@gmail.com> | 2013-02-22 21:49:33 +0100 |
commit | 44a6d1da2be916fe0f23a3ea4d5fcb391d7f65dd (patch) | |
tree | 31549ebf6ea5ea98e4347eb640d1caa685316f3e /user_guide_src | |
parent | 353f9834adf3f44c6c7a0f924089bb2b43360404 (diff) | |
parent | eb291c1d1e1116a4420fa30e587adeea0451eeb7 (diff) |
Merge branch 'develop' of github.com:EllisLab/CodeIgniter into feature/exit-status
Diffstat (limited to 'user_guide_src')
-rw-r--r-- | user_guide_src/source/changelog.rst | 47 | ||||
-rw-r--r-- | user_guide_src/source/database/call_function.rst | 2 | ||||
-rw-r--r-- | user_guide_src/source/general/controllers.rst | 4 | ||||
-rw-r--r-- | user_guide_src/source/general/routing.rst | 6 | ||||
-rw-r--r-- | user_guide_src/source/installation/upgrade_300.rst | 61 | ||||
-rw-r--r-- | user_guide_src/source/libraries/email.rst | 1 | ||||
-rw-r--r-- | user_guide_src/source/libraries/form_validation.rst | 4 | ||||
-rw-r--r-- | user_guide_src/source/libraries/loader.rst | 146 | ||||
-rw-r--r-- | user_guide_src/source/libraries/migration.rst | 2 | ||||
-rw-r--r-- | user_guide_src/source/tutorial/news_section.rst | 8 |
10 files changed, 164 insertions, 117 deletions
diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst index 8b9ec2539..216bf80bc 100644 --- a/user_guide_src/source/changelog.rst +++ b/user_guide_src/source/changelog.rst @@ -38,7 +38,6 @@ Release Date: Not Released - Updated support for php files in mimes.php. - Updated support for zip files in mimes.php. - Updated support for csv files in mimes.php. - - Added some more doctypes. - Added Romanian, Greek, Vietnamese and Cyrilic characters in *application/config/foreign_characters.php*. - Changed logger to only chmod when file is first created. - Removed previously deprecated SHA1 Library. @@ -56,16 +55,16 @@ Release Date: Not Released - Updated *ip_address* database field lengths from 16 to 45 for supporting IPv6 address on :doc:`Trackback Library <libraries/trackback>` and :doc:`Captcha Helper <helpers/captcha_helper>`. - Removed *cheatsheets* and *quick_reference* PDFs from the documentation. - Added availability checks where usage of dangerous functions like ``eval()`` and ``exec()`` is required. + - Added support for changing the file extension of log files using ``$config['log_file_extension']``. - Helpers - :doc:`Date Helper <helpers/date_helper>` changes include: - - ``now()`` now works with all timezone strings supported by PHP. - - Added an optional third parameter to ``timespan()`` that constrains the number of time units displayed. - - Added an optional parameter to ``timezone_menu()`` that allows more attributes to be added to the generated select tag. + - :php:func:`now()` now works with all timezone strings supported by PHP. + - Added an optional third parameter to :php:func:`timespan()` that constrains the number of time units displayed. + - Added an optional parameter to :php:func:`timezone_menu()` that allows more attributes to be added to the generated select tag. - Deprecated ``standard_date()``, which now just uses the native ``date()`` with `DateTime constants <http://www.php.net/manual/en/class.datetime.php#datetime.constants.types>`_. - - Added function ``date_range()`` that generates a list of dates between a specified period. - - ``create_captcha()`` accepts additional colors parameter, allowing for color customization. + - Added function :php:func:`date_range()` that generates a list of dates between a specified period. - :doc:`URL Helper <helpers/url_helper>` changes include: - Deprecated *separator* options **dash** and **underscore** for function :php:func:`url_title()` (they are only aliases for '-' and '_' respectively). - :php:func:`url_title()` will now trim extra dashes from beginning and end. @@ -74,7 +73,10 @@ Release Date: Not Released - Added support (auto-detection) for HTTP/1.1 response code 303 in :php:func:`redirect()`. - Changed :php:func:`redirect()` to only choose the **refresh** method only on IIS servers, instead of all servers on Windows (when **auto** is used). - Changed :php:func:`anchor()`, :php:func:`anchor_popup()`, and :php:func:`redirect()` to support protocol-relative URLs (e.g. *//ellislab.com/codeigniter*). - - Added XHTML Basic 1.1 doctype to :doc:`HTML Helper <helpers/html_helper>`. + - :doc:`HTML Helper <helpers/html_helper>` changes include: + - Added more doctypes. + - Changed application and environment config files to be loaded in a cascade-like manner. + - The doctypes array is now cached and loaded only once. - :doc:`Inflector Helper <helpers/inflector_helper>` changes include: - Changed :php:func:`humanize()` to allow passing an input separator as its second parameter. - Refactored :php:func:`plural()` and :php:func:`singular()` to avoid double pluralization and support more words. @@ -88,7 +90,10 @@ Release Date: Not Released - :doc:`Security Helper <helpers/security_helper>` changes include: - :php:func:`do_hash()` now uses PHP's native ``hash()`` function (supporting more algorithms) and is deprecated. - :php:func:`strip_image_tags()` is now an alias for the same method in the :doc:`Security Library <libraries/security>`. - - Removed previously deprecated helper function ``js_insert_smiley()`` from :doc:`Smiley Helper <helpers/smiley_helper>`. + - :doc:`Smiley Helper <helpers/smiley_helper>` changes include: + - Removed previously deprecated function ``js_insert_smiley()``. + - Changed application and environment config files to be loaded in a cascade-like manner. + - The smileys array is now cached and loaded only once. - :doc:`File Helper <helpers/file_helper>` changes include: - :php:func:`set_realpath()` can now also handle file paths as opposed to just directories. - Added an optional paramater to :php:func:`delete_files()` to enable it to skip deleting files such as *.htaccess* and *index.html*. @@ -210,6 +215,7 @@ Release Date: Not Released - Added **max_filename_increment** config setting. - Added an **index** parameter to the ``data()`` method. - Added the **min_width** and **min_height** options for images. + - Removed method ``clean_file_name()`` and its usage in favor of :doc:`Security Library <libraries/security>`'s ``sanitize_filename()``. - :doc:`Cart library <libraries/cart>` changes include: - ``insert()`` now auto-increments quantity for an item when inserted twice instead of resetting it, this is the default behaviour of large e-commerce sites. - *Product Name* strictness can be disabled by switching the ``$product_name_safe`` property to FALSE. @@ -236,6 +242,7 @@ Release Date: Not Released - Added rule **valid_url**. - Added support for named parameters in error messages. - :doc:`Language <libraries/language>` line keys must now be prefixed with **form_validation_**. + - Added rule **alpha_numeric_spaces**. - Added support for setting :doc:`Table <libraries/table>` class defaults in a config file. - :doc:`Caching Library <libraries/caching>` changes include: - Added Wincache driver. @@ -254,6 +261,7 @@ Release Date: Not Released - Removed unused protected method ``_get_ip()`` (:doc:`Input Library <libraries/input>`'s ``ip_address()`` should be used anyway). - Internal method ``_prep_q_encoding()`` now utilizes PHP's *mbstring* and *iconv* extensions (when available) and no longer has a second (``$from``) argument. - Added an optional parameter to ``print_debugger()`` to allow specifying which parts of the message should be printed ('headers', 'subject', 'body'). + - Added SMTP keepalive option to avoid opening the connection for each ``Email::send()``. Accessible as ``$smtp_keepalive``. - :doc:`Pagination Library <libraries/pagination>` changes include: - Added support for the anchor "rel" attribute. - Added support for setting custom attributes. @@ -264,7 +272,9 @@ Release Date: Not Released - :doc:`Encryption Library <libraries/encryption>` changes include: - Added support for hashing algorithms other than SHA1 and MD5. - Removed previously deprecated ``sha1()`` method. - - :doc:`Profiler Library <general/profiling>` now also displays database object names. + - :doc:`Profiler Library <general/profiling>` changes include: + - Database object names are now being displayed. + - The sum of all queries running times in seconds is now being displayed. - :doc:`Migration Library <libraries/migration>` changes include: - Added support for timestamp-based migrations (enabled by default). - Added ``$config['migration_type']`` to allow switching between *sequential* and *timestamp* migrations. @@ -329,16 +339,15 @@ Bug fixes for 3.0 - Fixed a bug where ``unlink()`` raised an error if cache file did not exist when you try to delete it. - Fixed a bug (#181) where a mis-spelling was in the form validation language file. -- Fixed a bug (#159, #163) that mishandled Query Builder nested transactions because _trans_depth was not getting incremented. +- Fixed a bug (#159, #163) - :doc:`Query Builder <database/query_builder>` nested transactions didn't work properly due to ``_trans_depth`` not being incremented. - Fixed a bug (#737, #75) - :doc:`Pagination <libraries/pagination>` anchor class was not set properly when using initialize method. -- Fixed a bug (#419) - ``auto_link()`` now recognizes URLs that come after a word boundary. +- Fixed a bug (#419) - :php:func:`auto_link()` didn't recognize URLs that come after a word boundary. - Fixed a bug (#724) - :doc:`Form Validation Library <libraries/form_validation>` rule **is_unique** didn't check if a database connection exists. - Fixed a bug (#647) - :doc:`Zip Library <libraries/zip>` internal method ``_get_mod_time()`` didn't suppress possible "stat failed" errors generated by ``filemtime()``. -- Fixed a bug (#608) - Fixes an issue with the Image_lib class not clearing properties completely. -- Fixed a bug (#157, #174) - the Image_lib clear() function now resets all variables to their default values. -- Fixed a bug where using $this->dbforge->create_table() with PostgreSQL database could lead to fetching whole table. -- Fixed a bug (#795) - Fixed form method and accept-charset when passing an empty array. -- Fixed a bug (#797) - timespan() was using incorrect seconds for year and month. +- Fixed a bug (#157, #174) - :doc:`Image Manipulation Library <libraries/image_lib>` method ``clear()`` didn't completely clear properties. +- Fixed a bug where :doc:`Database Forge <database/forge>` method ``create_table()`` with PostgreSQL database could lead to fetching the whole table. +- Fixed a bug (#795) - :doc:`Form Helper <helpers/form_helper>` :php:func:`form_open()` didn't add the default form *method* and *accept-charset* when an empty array is passed to it. +- Fixed a bug (#797) - :php:func:`timespan()` was using incorrect seconds for year and month. - Fixed a bug in CI_Cart::contents() where if called without a TRUE (or equal) parameter, it would fail due to a typo. - Fixed a bug (#696) - make oci_execute() calls inside num_rows() non-committing, since they are only there to reset which row is next in line for oci_fetch calls and thus don't need to be committed. - Fixed a bug (#406) - SQLSRV DB driver not returning resource on ``db_pconnect()``. @@ -472,6 +481,12 @@ Bug fixes for 3.0 - Fixed a bug (#113) - :doc:`Form Validation Library <libraries/form_validation>` didn't properly handle empty fields that were specified as an array. - Fixed a bug (#2061) - :doc:`Routing Class <general/routing>` didn't properly sanitize directory, controller and function triggers with **enable_query_strings** set to TRUE. - Fixed a bug - SQLSRV didn't support ``escape_like_str()`` or escaping an array of values. +- Fixed a bug - :doc:`DB result <database/results>` method ``list_fields()`` didn't reset its field pointer for the *mysql*, *mysqli* and *mssql* drivers. +- Fixed a bug (#73) - :doc:`Security Library <libraries/security>` method ``sanitize_filename()`` could be tricked by an XSS attack. +- Fixed a bug (#2211) - :doc:`Migration Library <libraries/migration>` extensions couldn't execute ``CI_Migration::__construct()``. +- Fixed a bug (#2255) - :doc:`Email Library <libraries/email>` didn't apply ``smtp_timeout``to socket reads and writes. +- Fixed a bug (#2239) - :doc:`Email Library <libraries/email>` improperly handled the Subject when used with ``bcc_batch_mode`` resulting in E_WARNING messages and an empty Subject. +- Fixed a bug (#2234) - :doc:`Query Builder <database/query_builder>` didn't reset JOIN cache for write-type queries. Version 2.1.3 ============= diff --git a/user_guide_src/source/database/call_function.rst b/user_guide_src/source/database/call_function.rst index 9890fc453..83fc870d0 100644 --- a/user_guide_src/source/database/call_function.rst +++ b/user_guide_src/source/database/call_function.rst @@ -7,7 +7,7 @@ $this->db->call_function(); This function enables you to call PHP database functions that are not natively included in CodeIgniter, in a platform independent manner. For -example, lets say you want to call the mysql_get_client_info() +example, let's say you want to call the mysql_get_client_info() function, which is **not** natively supported by CodeIgniter. You could do so like this:: diff --git a/user_guide_src/source/general/controllers.rst b/user_guide_src/source/general/controllers.rst index 729b08417..8cfb012a0 100644 --- a/user_guide_src/source/general/controllers.rst +++ b/user_guide_src/source/general/controllers.rst @@ -108,7 +108,7 @@ Passing URI Segments to your methods If your URI contains more then two segments they will be passed to your method as parameters. -For example, lets say you have a URI like this:: +For example, let's say you have a URI like this:: example.com/index.php/products/shoes/sandals/123 @@ -267,7 +267,7 @@ Simply create folders within your *application/controllers/* directory and place your controller classes within them. .. note:: When using this feature the first segment of your URI must - specify the folder. For example, lets say you have a controller located + specify the folder. For example, let's say you have a controller located here:: application/controllers/products/shoes.php diff --git a/user_guide_src/source/general/routing.rst b/user_guide_src/source/general/routing.rst index 2a0332088..0c6dfe888 100644 --- a/user_guide_src/source/general/routing.rst +++ b/user_guide_src/source/general/routing.rst @@ -12,7 +12,7 @@ In some instances, however, you may want to remap this relationship so that a different class/method can be called instead of the one corresponding to the URL. -For example, lets say you want your URLs to have this prototype:: +For example, let's say you want your URLs to have this prototype:: example.com/product/1/ example.com/product/2/ @@ -129,7 +129,7 @@ For those of you who don't know regular expressions and want to learn more about them, `regular-expressions.info <http://www.regular-expressions.info/>` might be a good starting point. -..note:: You can also mix and match wildcards with regular expressions. +.. note:: You can also mix and match wildcards with regular expressions. Callbacks ========= @@ -137,7 +137,7 @@ Callbacks If you are using PHP >= 5.3 you can use callbacks in place of the normal routing rules to process the back-references. Example:: - $route['products/([a-z]+)/edit/(\d+)'] = function ($product_type, $id) + $route['products/([a-zA-Z]+)/edit/(\d+)'] = function ($product_type, $id) { return 'catalog/product_edit/' . strtolower($product_type) . '/' . $id; }; diff --git a/user_guide_src/source/installation/upgrade_300.rst b/user_guide_src/source/installation/upgrade_300.rst index 94f6321be..02841ab6e 100644 --- a/user_guide_src/source/installation/upgrade_300.rst +++ b/user_guide_src/source/installation/upgrade_300.rst @@ -1,5 +1,5 @@ ############################# -Upgrading from 2.1.2 to 3.0.0 +Upgrading from 2.1.3 to 3.0.0 ############################# .. note:: These upgrade notes are for a version that is yet to be released. @@ -104,16 +104,47 @@ regular expression:: (.+) // matches ANYTHING (:any) // matches any character, except for '/' +***************************************** +Step 9: Update your libraries' file names +***************************************** -**************************************************************************** -Step 9: Check the calls to Array Helper's element() and elements() functions -**************************************************************************** +CodeIgniter 3.0 only allows library file names to be named in a *ucfirst* manner +(meaning that the first letter of the class name must be a capital). For example, +if you have the following library file: + + application/libraries/mylibrary.php + +... then you'll have to rename it to: + + application/libraries/Mylibrary.php + +The same goes for driver libraries and extensions and/or overrides of CodeIgniter's +own libraries and core classes. + + application/libraries/MY_email.php + application/core/MY_log.php + +The above files should respectively be renamed to the following: + + application/libraries/MY_Email.php + application/core/MY_Log.php + +***************************************************************************** +Step 10: Check the calls to Array Helper's element() and elements() functions +***************************************************************************** The default return value of these functions, when the required elements don't exist, has been changed from FALSE to NULL. +*********************************************************************** +Step 11: Check the calls to Directory Helper's directory_map() function +*********************************************************************** + +In the resulting array, directories now end with a trailing directory +separator (i.e. a slash, usually). + ************************************************************* -Step 10: Update usage of Database Forge's drop_table() method +Step 12: Update usage of Database Forge's drop_table() method ************************************************************* Up until now, ``drop_table()`` added an IF EXISTS clause by default or it didn't work @@ -135,7 +166,7 @@ If your application relies on IF EXISTS, you'll have to change its usage. all drivers with the exception of ODBC. *********************************************************** -Step 11: Change usage of Email library with multiple emails +Step 13: Change usage of Email library with multiple emails *********************************************************** The :doc:`Email Library <../libraries/email>` will automatically clear the @@ -150,7 +181,7 @@ pass FALSE as the first parameter in the ``send()`` method: } *************************************************** -Step 12: Update your Form_validation language lines +Step 14: Update your Form_validation language lines *************************************************** Two improvements have been made to the :doc:`Form Validation Library @@ -181,7 +212,7 @@ files and error messages format: later. **************************************************************** -Step 13: Remove usage of (previously) deprecated functionalities +Step 15: Remove usage of (previously) deprecated functionalities **************************************************************** In addition to the ``$autoload['core']`` configuration setting, there's a @@ -214,7 +245,7 @@ Security helper do_hash() :doc:`Security Helper <../helpers/security_helper>` function ``do_hash()`` is now just an alias for PHP's native ``hash()`` function. It is deprecated and scheduled for removal in CodeIgniter 3.1+. -.. note:: This function is still available, but you're strongly encouraged to remove it's usage sooner +.. note:: This function is still available, but you're strongly encouraged to remove its usage sooner rather than later. File helper read_file() @@ -224,7 +255,7 @@ File helper read_file() PHP's native ``file_get_contents()`` function. It is deprecated and scheduled for removal in CodeIgniter 3.1+. -.. note:: This function is still available, but you're strongly encouraged to remove it's usage sooner +.. note:: This function is still available, but you're strongly encouraged to remove its usage sooner rather than later. String helper repeater() @@ -233,7 +264,7 @@ String helper repeater() :doc:`String Helper <../helpers/string_helper>` function :php:func:`repeater()` is now just an alias for PHP's native ``str_repeat()`` function. It is deprecated and scheduled for removal in CodeIgniter 3.1+. -.. note:: This function is still available, but you're strongly encouraged to remove it's usage sooner +.. note:: This function is still available, but you're strongly encouraged to remove its usage sooner rather than later. String helper trim_slashes() @@ -243,7 +274,7 @@ String helper trim_slashes() for PHP's native ``trim()`` function (with a slash passed as its second argument). It is deprecated and scheduled for removal in CodeIgniter 3.1+. -.. note:: This function is still available, but you're strongly encouraged to remove it's usage sooner +.. note:: This function is still available, but you're strongly encouraged to remove its usage sooner rather than later. Email helper functions @@ -268,7 +299,7 @@ Date helper standard_date() to the availability of native PHP `constants <http://www.php.net/manual/en/class.datetime.php#datetime.constants.types>`_, which when combined with ``date()`` provide the same functionality. Furthermore, they have the exact same names as the ones supported by ``standard_date()``. Here are examples of how to replace -it's usage: +its usage: :: @@ -284,7 +315,7 @@ it's usage: // Replacement date(DATE_ATOM, $time); -.. note:: This function is still available, but you're strongly encouraged to remove its' usage sooner +.. note:: This function is still available, but you're strongly encouraged to remove its usage sooner rather than later as it is scheduled for removal in CodeIgniter 3.1+. Pagination library 'anchor_class' setting @@ -296,7 +327,7 @@ attribute to your anchors via the 'attributes' configuration setting. This inclu As a result of that, the 'anchor_class' setting is now deprecated and scheduled for removal in CodeIgniter 3.1+. -.. note:: This setting is still available, but you're strongly encouraged to remove its' usage sooner +.. note:: This setting is still available, but you're strongly encouraged to remove its usage sooner rather than later. String helper random_string() types 'unique' and 'encrypt' diff --git a/user_guide_src/source/libraries/email.rst b/user_guide_src/source/libraries/email.rst index 7d468251c..a55f1895d 100644 --- a/user_guide_src/source/libraries/email.rst +++ b/user_guide_src/source/libraries/email.rst @@ -89,6 +89,7 @@ Preference Default Value Options Descript **smtp_pass** No Default None SMTP Password. **smtp_port** 25 None SMTP Port. **smtp_timeout** 5 None SMTP Timeout (in seconds). +**smtp_keepalive** FALSE TRUE or FALSE (boolean) Enable persistent SMTP connections. **smtp_crypto** No Default tls or ssl SMTP Encryption **wordwrap** TRUE TRUE or FALSE (boolean) Enable word-wrap. **wrapchars** 76 Character count to wrap at. diff --git a/user_guide_src/source/libraries/form_validation.rst b/user_guide_src/source/libraries/form_validation.rst index ae7859aa3..8b35fdc75 100644 --- a/user_guide_src/source/libraries/form_validation.rst +++ b/user_guide_src/source/libraries/form_validation.rst @@ -877,7 +877,9 @@ Rule Parameter Description **less_than_equal_to** Yes Returns FALSE if the form element is greater than the parameter value, less_than_equal_to[8] or not numeric. **alpha** No Returns FALSE if the form element contains anything other than alphabetical characters. -**alpha_numeric** No Returns FALSE if the form element contains anything other than alpha-numeric characters. +**alpha_numeric** No Returns FALSE if the form element contains anything other than alpha-numeric characters. +**alpha_numeric_spaces** No Returns FALSE if the form element contains anything other than alpha-numeric characters + or spaces. Should be used after trim to avoid spaces at the beginning or end. **alpha_dash** No Returns FALSE if the form element contains anything other than alpha-numeric characters, underscores or dashes. **numeric** No Returns FALSE if the form element contains anything other than numeric characters. diff --git a/user_guide_src/source/libraries/loader.rst b/user_guide_src/source/libraries/loader.rst index 615aba1c2..b048f4881 100644 --- a/user_guide_src/source/libraries/loader.rst +++ b/user_guide_src/source/libraries/loader.rst @@ -11,14 +11,15 @@ can be libraries (classes) :doc:`View files <../general/views>`, .. note:: This class is initialized automatically by the system so there is no need to do it manually. -The following functions are available in this class: +The following methods are available in this class: $this->load->library('class_name', $config, 'object name') -=========================================================== +========================================================== -This function is used to load core classes. Where class_name is the -name of the class you want to load. Note: We use the terms "class" and -"library" interchangeably. +This method is used to load core classes. Where class_name is the +name of the class you want to load. + +.. note:: We use the terms "class" and "library" interchangeably. For example, if you would like to send email with CodeIgniter, the first step is to load the email class within your controller:: @@ -26,15 +27,15 @@ step is to load the email class within your controller:: $this->load->library('email'); Once loaded, the library will be ready for use, using -$this->email->*some_function*(). +$this->email->*some_method*(). Library files can be stored in subdirectories within the main -"libraries" folder, or within your personal application/libraries -folder. To load a file located in a subdirectory, simply include the -path, relative to the "libraries" folder. For example, if you have file -located at:: +"libraries" directory, or within your personal application/libraries +directory. To load a file located in a subdirectory, simply include the +path, relative to the "libraries" directory. For example, if you have +file located at:: - libraries/flavors/chocolate.php + libraries/flavors/Chocolate.php You will load it using:: @@ -43,7 +44,7 @@ You will load it using:: You may nest the file in as many subdirectories as you want. Additionally, multiple libraries can be loaded at the same time by -passing an array of libraries to the load function. +passing an array of libraries to the load method. :: @@ -56,10 +57,10 @@ The second (optional) parameter allows you to optionally pass configuration setting. You will typically pass these as an array:: $config = array ( - 'mailtype' => 'html', - 'charset' => 'utf-8, - 'priority' => '1' - ); + 'mailtype' => 'html', + 'charset' => 'utf-8, + 'priority' => '1' + ); $this->load->library('email', $config); @@ -84,16 +85,15 @@ third parameter:: $this->load->library('calendar', '', 'my_calendar'); // Calendar class is now accessed using: - $this->my_calendar Please take note, when multiple libraries are supplied in an array for the first parameter, this parameter is discarded. $this->load->driver('parent_name', $config, 'object name') -=========================================================== +========================================================== -This function is used to load driver libraries. Where parent_name is the +This method is used to load driver libraries. Where parent_name is the name of the parent class you want to load. As an example, if you would like to use sessions with CodeIgniter, the first @@ -102,15 +102,15 @@ step is to load the session driver within your controller:: $this->load->driver('session'); Once loaded, the library will be ready for use, using -$this->session->*some_function*(). +$this->session->*some_method*(). Driver files must be stored in a subdirectory within the main -"libraries" folder, or within your personal application/libraries -folder. The subdirectory must match the parent class name. Read the +"libraries" directory, or within your personal application/libraries +directory. The subdirectory must match the parent class name. Read the :doc:`Drivers <../general/drivers>` description for details. Additionally, multiple driver libraries can be loaded at the same time by -passing an array of drivers to the load function. +passing an array of drivers to the load method. :: @@ -122,11 +122,11 @@ Setting options The second (optional) parameter allows you to optionally pass configuration settings. You will typically pass these as an array:: - $config = array ( - 'sess_driver' => 'cookie', - 'sess_encrypt_cookie' => true, - 'encryption_key' => 'mysecretkey' - ); + $config = array( + 'sess_driver' => 'cookie', + 'sess_encrypt_cookie' => true, + 'encryption_key' => 'mysecretkey' + ); $this->load->driver('session', $config); @@ -135,12 +135,12 @@ is explained in detail in its own page, so please read the information regarding each one you would like to use. Assigning a Driver to a different object name ----------------------------------------------- +--------------------------------------------- If the third (optional) parameter is blank, the library will be assigned to an object with the same name as the parent class. For example, if the library is named Session, it will be assigned to a variable named -$this->session. +``$this->session``. If you prefer to set your own class names you can pass its value to the third parameter:: @@ -148,32 +148,33 @@ third parameter:: $this->load->library('session', '', 'my_session'); // Session class is now accessed using: - $this->my_session -.. note:: Driver libraries may also be loaded with the library() method, - but it is faster to use driver() +.. note:: Driver libraries may also be loaded with the ``library()`` method, + but it is faster to use ``driver()``. -$this->load->view('file_name', $data, true/false) -================================================== +$this->load->view('file_name', $data, TRUE/FALSE) +================================================= -This function is used to load your View files. If you haven't read the +This method is used to load your View files. If you haven't read the :doc:`Views <../general/views>` section of the user guide it is -recommended that you do since it shows you how this function is +recommended that you do since it shows you how this method is typically used. The first parameter is required. It is the name of the view file you -would like to load. Note: The .php file extension does not need to be -specified unless you use something other than .php. +would like to load. + +.. note:: The .php file extension does not need to be specified unless + you use something other than .php. The second **optional** parameter can take an associative array or an object as input, which it runs through the PHP -`extract <http://www.php.net/extract>`_ function to convert to variables +`extract() <http://www.php.net/extract>`_ function to convert to variables that can be used in your view files. Again, read the :doc:`Views <../general/views>` page to learn how this might be useful. The third **optional** parameter lets you change the behavior of the -function so that it returns data as a string rather than sending it to +method so that it returns data as a string rather than sending it to your browser. This can be useful if you want to process the data in some way. If you set the parameter to true (boolean) it will return data. The default behavior is false, which sends it to your browser. Remember to @@ -189,79 +190,76 @@ $this->load->model('model_name'); $this->load->model('model_name'); -If your model is located in a sub-folder, include the relative path from -your models folder. For example, if you have a model located at +If your model is located in a subdirectory, include the relative path +from your models directory. For example, if you have a model located at application/models/blog/queries.php you'll load it using:: $this->load->model('blog/queries'); - If you would like your model assigned to a different object name you can -specify it via the second parameter of the loading function:: +specify it via the second parameter of the loading method:: $this->load->model('model_name', 'fubar'); + $this->fubar->method(); - $this->fubar->function(); - -$this->load->database('options', true/false) +$this->load->database('options', TRUE/FALSE) ============================================ -This function lets you load the database class. The two parameters are +This method lets you load the database class. The two parameters are **optional**. Please see the :doc:`database <../database/index>` section for more info. $this->load->vars($array) ========================= -This function takes an associative array as input and generates +This method takes an associative array as input and generates variables using the PHP `extract <http://www.php.net/extract>`_ -function. This function produces the same result as using the second -parameter of the $this->load->view() function above. The reason you -might want to use this function independently is if you would like to +method. This method produces the same result as using the second +parameter of the ``$this->load->view()`` method above. The reason you +might want to use this method independently is if you would like to set some global variables in the constructor of your controller and have -them become available in any view file loaded from any function. You can -have multiple calls to this function. The data get cached and merged +them become available in any view file loaded from any method. You can +have multiple calls to this method. The data get cached and merged into one array for conversion to variables. $this->load->get_var($key) -=========================== +========================== -This function checks the associative array of variables available to +This method checks the associative array of variables available to your views. This is useful if for any reason a var is set in a library -or another controller method using $this->load->vars(). +or another controller method using ``$this->load->vars()``. $this->load->get_vars() -=========================== +======================= -This function retrieves all variables available to -your views. +This method retrieves all variables available to your views. $this->load->helper('file_name') -================================= +================================ -This function loads helper files, where file_name is the name of the +This method loads helper files, where file_name is the name of the file, without the _helper.php extension. -$this->load->file('filepath/filename', true/false) +$this->load->file('filepath/filename', TRUE/FALSE) ================================================== -This is a generic file loading function. Supply the filepath and name in +This is a generic file loading method. Supply the filepath and name in the first parameter and it will open and read the file. By default the data is sent to your browser, just like a View file, but if you set the second parameter to true (boolean) it will instead return the data as a string. $this->load->language('file_name') -=================================== +================================== -This function is an alias of the :doc:`language loading -function <language>`: $this->lang->load() +This method is an alias of the :doc:`language loading +method <language>`: ``$this->lang->load()`` $this->load->config('file_name') -================================= +================================ -This function is an alias of the :doc:`config file loading -function <config>`: $this->config->load() +This method is an alias of the :doc:`config file loading +method <config>`: ``$this->config->load()`` Application "Packages" ====================== @@ -269,7 +267,7 @@ Application "Packages" An application package allows for the easy distribution of complete sets of resources in a single directory, complete with its own libraries, models, helpers, config, and language files. It is recommended that -these packages be placed in the application/third_party folder. Below +these packages be placed in the application/third_party directory. Below is a sample map of an package directory Sample Package "Foo Bar" Directory Map @@ -311,7 +309,7 @@ $this->load->remove_package_path() When your controller is finished using resources from an application package, and particularly if you have other application packages you want to work with, you may wish to remove the package path so the Loader -no longer looks in that folder for resources. To remove the last path +no longer looks in that directory for resources. To remove the last path added, simply call the method with no parameters. $this->load->remove_package_path() @@ -346,4 +344,4 @@ calling add_package_path(). // Again without the second parameter: $this->load->add_package_path(APPPATH.'my_app'); $this->load->view('my_app_index'); // Loads - $this->load->view('welcome_message'); // Loads + $this->load->view('welcome_message'); // Loads
\ No newline at end of file diff --git a/user_guide_src/source/libraries/migration.rst b/user_guide_src/source/libraries/migration.rst index 9a7b10d64..b734f5c34 100644 --- a/user_guide_src/source/libraries/migration.rst +++ b/user_guide_src/source/libraries/migration.rst @@ -10,7 +10,7 @@ need to be run against the production machines next time you deploy. The database table **migration** tracks which migrations have already been run so all you have to do is update your application files and -call **$this->migrate->current()** to work out which migrations should be run. +call **$this->migration->current()** to work out which migrations should be run. The current version is found in **config/migration.php**. ******************** diff --git a/user_guide_src/source/tutorial/news_section.rst b/user_guide_src/source/tutorial/news_section.rst index b64ea2aae..d7754e9f3 100644 --- a/user_guide_src/source/tutorial/news_section.rst +++ b/user_guide_src/source/tutorial/news_section.rst @@ -68,7 +68,7 @@ following code to your model. $query = $this->db->get('news'); return $query->result_array(); } - + $query = $this->db->get_where('news', array('slug' => $slug)); return $query->row_array(); } @@ -146,7 +146,7 @@ and add the next piece of code. <?php foreach ($news as $news_item): ?> <h2><?php echo $news_item['title'] ?></h2> - <div id="main"> + <div class="main"> <?php echo $news_item['text'] ?> </div> <p><a href="<?php echo $news_item['slug'] ?>">View article</a></p> @@ -162,7 +162,7 @@ The news overview page is now done, but a page to display individual news items is still absent. The model created earlier is made in such way that it can easily be used for this functionality. You only need to add some code to the controller and create a new view. Go back to the -news controller and add the following lines to the file. +news controller and update ``view()`` with the following: :: @@ -211,4 +211,4 @@ a slug to the view method in the news controller. $route['default_controller'] = 'pages/view'; Point your browser to your document root, followed by index.php/news and -watch your news page.
\ No newline at end of file +watch your news page. |