summaryrefslogtreecommitdiffstats
path: root/user_guide_src/source
diff options
context:
space:
mode:
Diffstat (limited to 'user_guide_src/source')
-rw-r--r--user_guide_src/source/_themes/eldocs/static/asset/css/common.css2
-rw-r--r--user_guide_src/source/changelog.rst222
-rw-r--r--user_guide_src/source/conf.py2
-rw-r--r--user_guide_src/source/database/configuration.rst28
-rw-r--r--user_guide_src/source/database/connecting.rst8
-rw-r--r--user_guide_src/source/database/examples.rst8
-rw-r--r--user_guide_src/source/database/helpers.rst6
-rw-r--r--user_guide_src/source/database/index.rst4
-rw-r--r--user_guide_src/source/database/queries.rst19
-rw-r--r--user_guide_src/source/database/query_builder.rst (renamed from user_guide_src/source/database/active_record.rst)42
-rw-r--r--user_guide_src/source/database/results.rst29
-rw-r--r--user_guide_src/source/database/utilities.rst8
-rw-r--r--user_guide_src/source/general/common_functions.rst5
-rw-r--r--user_guide_src/source/general/creating_libraries.rst16
-rw-r--r--user_guide_src/source/general/environments.rst10
-rw-r--r--user_guide_src/source/general/models.rst16
-rw-r--r--user_guide_src/source/general/requirements.rst6
-rw-r--r--user_guide_src/source/general/styleguide.rst32
-rw-r--r--user_guide_src/source/general/urls.rst9
-rw-r--r--user_guide_src/source/general/views.rst22
-rw-r--r--user_guide_src/source/helpers/date_helper.rst165
-rw-r--r--user_guide_src/source/helpers/directory_helper.rst2
-rw-r--r--user_guide_src/source/helpers/form_helper.rst269
-rw-r--r--user_guide_src/source/helpers/html_helper.rst62
-rw-r--r--user_guide_src/source/helpers/path_helper.rst20
-rw-r--r--user_guide_src/source/helpers/security_helper.rst7
-rw-r--r--user_guide_src/source/helpers/string_helper.rst30
-rw-r--r--user_guide_src/source/installation/upgrade_200.rst11
-rw-r--r--user_guide_src/source/installation/upgrade_300.rst15
-rw-r--r--user_guide_src/source/libraries/config.rst12
-rw-r--r--user_guide_src/source/libraries/email.rst28
-rw-r--r--user_guide_src/source/libraries/file_uploading.rst16
-rw-r--r--user_guide_src/source/libraries/form_validation.rst132
-rw-r--r--user_guide_src/source/libraries/input.rst33
-rw-r--r--user_guide_src/source/libraries/javascript.rst4
-rw-r--r--user_guide_src/source/libraries/loader.rst6
-rw-r--r--user_guide_src/source/libraries/output.rst9
-rw-r--r--user_guide_src/source/libraries/sessions.rst4
-rw-r--r--user_guide_src/source/libraries/table.rst2
-rw-r--r--user_guide_src/source/libraries/uri.rst2
-rw-r--r--user_guide_src/source/libraries/xmlrpc.rst28
-rw-r--r--user_guide_src/source/overview/at_a_glance.rst2
-rw-r--r--user_guide_src/source/overview/features.rst2
-rw-r--r--user_guide_src/source/tutorial/create_news_items.rst2
-rw-r--r--user_guide_src/source/tutorial/index.rst2
-rw-r--r--user_guide_src/source/tutorial/news_section.rst4
-rw-r--r--user_guide_src/source/tutorial/static_pages.rst2
47 files changed, 939 insertions, 426 deletions
diff --git a/user_guide_src/source/_themes/eldocs/static/asset/css/common.css b/user_guide_src/source/_themes/eldocs/static/asset/css/common.css
index b9e28aec0..66768bac6 100644
--- a/user_guide_src/source/_themes/eldocs/static/asset/css/common.css
+++ b/user_guide_src/source/_themes/eldocs/static/asset/css/common.css
@@ -2,7 +2,7 @@
CodeIgniter
http://codeigniter.com
-An open source application development framework for PHP 5.1.6 or newer
+An open source application development framework for PHP 5.2.4 or newer
NOTICE OF LICENSE
diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst
index 48011f208..74de512f7 100644
--- a/user_guide_src/source/changelog.rst
+++ b/user_guide_src/source/changelog.rst
@@ -9,8 +9,7 @@ Release Date: Not Released
- License
- - CodeIgniter has been relicensed with the Open Software License (3.0),
- eliminating its old proprietary licensing.
+ - CodeIgniter has been relicensed with the Open Software License (3.0), eliminating its old proprietary licensing.
- All system files are licensed with OSL 3.0.
- Config, error, and sample files shipped in the application folder are
@@ -19,53 +18,124 @@ Release Date: Not Released
- General Changes
+ - PHP 5.1.6 is no longer supported. CodeIgniter now requires PHP 5.2.4.
+ - ``$_SERVER['CI_ENV']`` can now be set to control the ``ENVIRONMENT`` constant.
- Added an optional backtrace to php-error template.
- Added Android to the list of user agents.
- - Added Windows 7 to the list of user platforms.
+ - Added Windows 7, Android, Blackberry and iOS to the list of user platforms.
+ - Added Fennec (Firefox for mobile) to the list of mobile user agents.
- Ability to log certain error types, not all under a threshold.
- Added support for pem, p10, p12, p7a, p7c, p7m, p7r, p7s, crt, crl, der, kdb, rsa, cer, sst, csr Certs to mimes.php.
- Added support for pgp and gpg to mimes.php.
- Added support for 3gp, 3g2, mp4, wmv, f4v, vlc Video files to mimes.php.
- Added support for m4a, aac, m4u, xspf, au, ac3, flac, ogg Audio files to mimes.php.
- Added support for kmz and kml (Google Earth) files to mimes.php.
+ - Added Romanian and Greek characters in foreign_characters.php
+ - Updated support for doc files in mimes.php.
- Added application/xml for xml and application/xml, text/xsl for xsl in mimes.php.
- Changed logger to only chmod when file is first created.
- Removed previously deprecated SHA1 Library.
- Removed previously deprecated use of ``$autoload['core']`` in application/config/autoload.php.
Only entries in ``$autoload['libraries']`` are auto-loaded now.
+ - Added some more doctypes.
+ - Updated all classes to be written in PHP 5 style, with visibility declarations and no ``var`` usage for properties.
+ - Moved error templates to "application/views/errors"
+ - Global config files are loaded first, then environment ones. Environment config keys overwrite base ones, allowing to only set the keys we want changed per Env.
- Helpers
+ - create_captcha() accepts additional colors parameter, allowing for color customization
- url_title() will now trim extra dashes from beginning and end.
- Added XHTML Basic 1.1 doctype to :doc:`HTML Helper <helpers/html_helper>`.
- - Changed humanize to include a second param for the separator.
+ - Changed humanize() to include a second param for the separator.
+ - Refactored ``plural()`` and ``singular()`` to avoid double pluralization and support more words.
+ - Added an optional third parameter to ``force_download()`` that enables/disables sending the actual file MIME type in the Content-Type header (disabled by default).
+ - Added an optional third parameter to ``timespan()`` that constrains the number of time units displayed.
+ - Added a work-around in force_download() for a bug Android <= 2.1, where the filename extension needs to be in uppercase.
+ - form_dropdown() will now also take an array for unity with other form helpers.
+ - set_realpath() can now also handle file paths as opposed to just directories.
+ - do_hash() now uses PHP's native hash() function, supporting more algorithms.
+ - Added an optional paramater to ``delete_files()`` to enable it to skip deleting files such as .htaccess and index.html.
+ - Removed deprecated helper function ``js_insert_smiley()`` from smiley helper.
- Database
- - Added new :doc:`Active Record <database/active_record>` methods that return
- the SQL string of queries without executing them: get_compiled_select(),
- get_compiled_insert(), get_compiled_update(), get_compiled_delete().
- - Taking care of LIKE condition when used with MySQL UPDATE statement.
- - Adding $escape parameter to the order_by function, this enables ordering by custom fields.
+ - Renamed the Active Record class to Query Builder to remove confusion with the Active Record design pattern.
+ - Added the ability to insert objects with insert_batch() in :doc:`Query Builder <database/query_builder>`.
+ - Added new :doc:`Query Builder <database/query_builder>` methods that return the SQL string of queries without executing them: get_compiled_select(), get_compiled_insert(), get_compiled_update(), get_compiled_delete().
+ - Adding $escape parameter to the order_by() method, this enables ordering by custom fields.
+ - Improved support for the MySQLi driver, including:
+ - OOP style of the PHP extension is now used, instead of the procedural aliases.
+ - Server version checking is now done via ``mysqli::$server_info`` instead of running an SQL query.
+ - Added persistent connections support for PHP >= 5.3.
+ - Added 'dsn' configuration setting for drivers that support DSN strings (PDO, PostgreSQL, Oracle, ODBC, CUBRID).
+ - Improved PDO database support.
+ - Added Interbase/Firebird database support via the "interbase" driver.
+ - Added an optional database name parameter to db_select().
+ - Replaced the _error_message() and _error_number() methods with error(), that returns an array containing the last database error code and message.
+ - Improved version() implementation so that drivers that have a native function to get the version number don't have to be defined in the core DB_driver class.
+ - Improved support of the PostgreSQL driver, including:
+ - pg_version() is now used to get the database version number, when possible.
+ - Added db_set_charset() support.
+ - Added _optimize_table() support for the :doc:`Database Utility Class <database/utilities>` (rebuilds table indexes).
+ - Added boolean data type support in escape().
+ - Added update_batch() support.
+ - Removed limit() and order_by() support for UPDATE and DELETE queries in as PostgreSQL does not support those features.
+ - Added a constructor to the DB_result class and moved all driver-specific properties and logic out of the base DB_driver class to allow better abstraction.
+ - Removed protect_identifiers() and renamed internal method _protect_identifiers() to it instead - it was just an alias.
+ - MySQL and MySQLi drivers now require at least MySQL version 5.1.
+ - db_set_charset() now only requires one parameter (collation was only needed due to legacy support for MySQL versions prior to 5.1).
+ - Added DSN string support for CUBRID.
+ - Added persistent connections support for CUBRID.
+ - Added random ordering support for MSSQL, SQLSRV.
+ - Added support for SQLite3 database driver.
+ - Improved support of the Oracle (OCI8) driver, including:
+ - Added DSN string support (Easy Connect and TNS).
+ - Added support for dropping tables to :doc:`Database Forge <database/forge>`.
+ - Added support for listing database schemas to :doc:`Database Utilities <database/utilities>`.
+ - Generally improved for speed and cleaned up all of its components.
+ - *Row* result methods now really only fetch only the needed number of rows, instead of depending entirely on result().
+ - num_rows() is now only called explicitly by the developer and no longer re-executes statements.
+ - Added replace() support for SQLite.
+ - Renamed internal method _escape_identifiers() to escape_identifiers().
+ - Added SQLite support for drop_table() in :doc:`Database Forge <database/forge>`.
+ - Added ODBC support for create_database(), drop_database() and drop_table() in :doc:`Database Forge <database/forge>`.
+ - Added PDO support for create_database(), drop_database and drop_table() in :doc:`Database Forge <database/forge>`.
+ - Added MSSQL, SQLSRV support for optimize_table() in :doc:`Database Utility <database/utilities>`.
+ - Improved CUBRID support for list_databases() in :doc:`Database Utility <database/utilities>` (until now only the currently used database was returned).
+ - Added unbuffered_row() method for getting a row without prefetching whole result (consume less memory).
- Libraries
- Added max_filename_increment config setting for Upload library.
- CI_Loader::_ci_autoloader() is now a protected method.
- - Modified valid_ip() to use PHP's filter_var() when possible (>= PHP 5.2) in the :doc:`Form Validation library <libraries/form_validation>`.
- - Added custom filename to Email::attach() as $this->email->attach($filename, $disposition, $newname)
- - Cart library changes include:
+ - Added custom filename to Email::attach() as $this->email->attach($filename, $disposition, $newname).
+ - Added possibility to send attachment as buffer string in Email::attach() as $this->email->attach($buffer, $disposition, $newname, $mime).
+ - :doc:`Cart library <libraries/cart>` changes include:
- It now auto-increments quantity's instead of just resetting it, this is the default behaviour of large e-commerce sites.
- - Product Name strictness can be disabled via the Cart Library by switching "$product_name_safe"
- - Added function remove() to remove a cart item, updating with quantity of 0 seemed like a hack but has remained to retain compatability
- - Image manipulation library changes include:
+ - Product Name strictness can be disabled via the Cart Library by switching "$product_name_safe".
+ - Added function remove() to remove a cart item, updating with quantity of 0 seemed like a hack but has remained to retain compatibility.
+ - :doc:`Image Manipulation library <libraries/image_lib>` changes include:
- The initialize() method now only sets existing class properties.
- Added support for 3-length hex color values for wm_font_color and wm_shadow_color properties, as well as validation for them.
- - Class properties wm_font_color, wm_shadow_color and wm_use_drop_shadow are now protected, to avoid breaking the text_watermark() method
- if they are set manually after initialization.
- - Minor speed optimizations and method & property visibility declarations in the Calendar Library.
+ - Class properties wm_font_color, wm_shadow_color and wm_use_drop_shadow are now protected, to avoid breaking the text_watermark() method if they are set manually after initialization.
+ - If property maintain_ratio is set to TRUE, image_reproportion() now doesn't need both width and height to be specified.
- Removed SHA1 function in the :doc:`Encryption Library <libraries/encryption>`.
- Added $config['csrf_regeneration'] to the CSRF protection in the :doc:`Security library <libraries/security>`, which makes token regeneration optional.
+ - :doc:`Form Validation library <libraries/form_validation>` changes include:
+ - Added method error_array() to return all error messages as an array.
+ - Added method set_data() to set an alternative data array to be validated instead of the default $_POST.
+ - Added method reset_validation(), which resets internal validation variables in case of multiple validation routines.
+ - Added support for setting error delimiters in the config file via $config['error_prefix'] and $config['error_suffix'].
+ - _execute() now considers input data to be invalid if a specified rule is not found.
+ - Removed method is_numeric() as it exists as a native PHP function and _execute() will find and use that (the 'is_numeric' rule itself is deprecated since 1.6.1).
+ - Native PHP functions used as rules can now accept an additional parameter, other than the data itself.
+ - Changed the :doc:`Session Library <libraries/sessions>` to select only one row when using database sessions.
+ - Added all_flashdata() method to session class. Returns an associative array of only flashdata.
+ - Allowed for setting table class defaults in a config file.
+ - Added a Wincache driver to the :doc:`Caching Library <libraries/caching>`.
+ - Added dsn (delivery status notification) option to the :doc:`Email Library <libraries/email>`.
+ - Enabled public access to Email library's set_header() for adding additional headers to e-mails. Original function _set_header() now renamed to set_header().
- Core
@@ -73,35 +143,123 @@ Release Date: Not Released
- Removed CI_CORE boolean constant from CodeIgniter.php (no longer Reactor and Core versions).
- Added method get_vars() to CI_Loader to retrieve all variables loaded with $this->load->vars().
- is_loaded() function from system/core/Commons.php now returns a reference.
+ - $config['rewrite_short_tags'] now has no effect when using PHP 5.4 as *<?=* will always be available.
+ - Added method() to CI_Input to retrieve $_SERVER['REQUEST_METHOD'].
+ - Modified valid_ip() to use PHP's filter_var() in the :doc:`Input Library <libraries/input>`.
+ - Added support for HTTP-Only cookies with new config option ``cookie_httponly`` (default FALSE).
+ - Renamed method _call_hook() to call_hook() in the :doc:`Hooks Library <general/hooks>`.
+ - Added get_content_type() method to the :doc:`Output Library <libraries/output>`.
+ - Added get_mimes() function to system/core/Commons.php to return the config/mimes.php array.
Bug fixes for 3.0
------------------
-- 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 Active Record nested transactions because _trans_depth was not getting incremented.
+- 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 (#737, #75) where 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 (#724) - is_unique in form validation now checks that you are connected to a database.
-- Fixed a bug (#647) - _get_mod_time() in Zip library no longer generates stat failed errors
-- Fixed a bug (#608) - Fixes an issue with the Image_lib class not clearing properties completely
-- Fixed bugs (#157 and #174) - the Image_lib clear() function now resets all variables to their default values.
+- Fixed a bug (#647) - _get_mod_time() in Zip library no longer generates stat failed errors.
+- 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 (#797) - 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 reuturning resource on <samp>db_pconnect()</samp>.
+- 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()``.
- Fixed a bug in CI_Image_lib::gd_loaded() where it was possible for the script execution to end or a PHP E_WARNING message to be emitted.
-- In Pagination library, when use_page_numbers=TRUE previous link and page 1 link do not have the same url
+- Fixed a bug in the :doc:`Pagination library <libraries/pagination>` where when use_page_numbers=TRUE previous link and page 1 link did not have the same url.
- Fixed a bug (#561) - Errors in :doc:`XML-RPC Library <libraries/xmlrpc>` were not properly escaped.
- Fixed a bug (#904) - ``CI_Loader::initialize()`` caused a PHP Fatal error to be triggered if error level E_STRICT is used.
+- Fixed a hosting edge case where an empty $_SERVER['HTTPS'] variable would evaluate to 'on'.
+- Fixed a bug (#154) - ``CI_Session::sess_update()`` caused the session to be destroyed on pages where multiple AJAX requests were executed at once.
+- Fixed a possible bug in ``CI_Input::is_ajax_request()`` where some clients might not send the X-Requested-With HTTP header value exactly as 'XmlHttpRequest'.
+- Fixed a bug (#1039) - MySQL's _backup() method failed due to a table name not being escaped.
+- Fixed a bug (#1070) - CI_DB_driver::initialize() didn't set a character set if a database is not selected.
+- Fixed a bug (#177) - CI_Form_validation::set_value() didn't set the default value if POST data is NULL.
+- Fixed a bug (#68, #414) - Oracle's escape_str() didn't properly escape LIKE wild characters.
+- Fixed a bug (#81) - ODBC's list_fields() and field_data() methods skipped the first column due to odbc_field_*() functions' index starting at 1 instead of 0.
+- Fixed a bug (#129) - ODBC's num_rows() returned -1 in some cases, due to not all subdrivers supporting the odbc_num_rows() function.
+- Fixed a bug (#153) - E_NOTICE being generated by getimagesize() in the :doc:`File Uploading Library <libraries/file_uploading>`.
+- Fixed a bug (#611) - SQLSRV's error handling methods used to issue warnings when there's no actual error.
+- Fixed a bug (#1036) - is_write_type() method in the :doc:`Database Library <database/index>` didn't return TRUE for RENAME queries.
+- Fixed a bug in PDO's _version() method where it used to return the client version as opposed to the server one.
+- Fixed a bug in PDO's insert_id() method where it could've failed if it's used with Postgre versions prior to 8.1.
+- Fixed a bug in CUBRID's affected_rows() method where a connection resource was passed to cubrid_affected_rows() instead of a result.
+- Fixed a bug (#638) - db_set_charset() ignored its arguments and always used the configured charset instead.
+- Fixed a bug (#413) - Oracle's error handling methods used to only return connection-related errors.
+- Fixed a bug (#804) - Profiler library was trying to handle objects as strings in some cases, resulting in warnings being issued by htmlspecialchars().
+- Fixed a bug (#1101) - MySQL/MySQLi result method field_data() was implemented as if it was handling a DESCRIBE result instead of the actual result set.
+- Fixed a bug in Oracle's :doc:`Database Forge Class <database/forge>` method _create_table() where it failed with AUTO_INCREMENT as it's not supported.
+- Fixed a bug (#1080) - When using the SMTP protocol, the :doc:`Email Library <libraries/email>` send() method was returning TRUE even if the connection/authentication against the server failed.
+- Fixed a bug (#499) - a CSRF cookie was created even with CSRF protection being disabled.
+- Fixed a bug (#306) - ODBC's insert_id() method was calling non-existent function odbc_insert_id(), which resulted in a fatal error.
+- Fixed a bug in Oracle's DB_result class where the cursor id passed to it was always NULL.
+- Fixed a bug (#64) - Regular expression in DB_query_builder.php failed to handle queries containing SQL bracket delimiters in the join condition.
+- Fixed a bug in the :doc:`Session Library <libraries/sessions>` where a PHP E_NOTICE error was triggered by _unserialize() due to results from databases such as MSSQL and Oracle being space-padded on the right.
+- Fixed a bug (#501) - set_rules() to check if the request method is not 'POST' before aborting, instead of depending on count($_POST) in the :doc:`Form Validation Library <libraries/form_validation>`.
+- Fixed a bug (#940) - csrf_verify() used to set the CSRF cookie while processing a POST request with no actual POST data, which resulted in validating a request that should be considered invalid.
+- Fixed a bug (#136) - PostgreSQL, MySQL and MySQLi's escape_str() method didn't properly escape LIKE wild characters.
+- Fixed a bug in the library loader where some PHP versions wouldn't execute the class constructor.
+- Fixed a bug (#88) - An unexisting property was used for configuration of the Memcache cache driver.
+- Fixed a bug (#14) - create_database() method in the :doc:`Database Forge Library <database/forge>` didn't utilize the configured database character set.
+- Fixed a bug (#23, #1238) - delete_all() in the `Database Caching Library <database/caching>` used to delete .htaccess and index.html files, which is a potential security risk.
+- Fixed a bug in :doc:`Trackback Library <libraries/trackback>` method validate_url() where it didn't actually do anything, due to input not being passed by reference.
+- Fixed a bug (#11, #183, #863) - CI_Form_validation::_execute() silently continued to the next rule, if a rule method/function is not found.
+- Fixed a bug (#122) Where routed uri string was being reported incorrectly in sub-directories.
+- Fixed a bug (#1242) - read_dir() in the :doc:`Zip Library <libraries/zip>` wasn't compatible with Windows.
+- Fixed a bug (#306) - ODBC driver didn't have an _insert_batch() method, which resulted in fatal error being triggered when insert_batch() is used with it.
+- Fixed a bug in MSSQL and SQLSrv's _truncate() where the TABLE keyword was missing.
+- Fixed a bug in PDO's trans_commit() method where it failed due to an erroneous property name.
+- Fixed a bug (#798) - update() used to ignore LIKE conditions that were set with like().
+- Fixed a bug in Oracle's and MSSQL's delete() methods where an erroneous SQL statement was generated when used with limit().
+- Fixed a bug in SQLSRV's delete() method where like() and limit() conditions were ignored.
+- Fixed a bug (#1265) - Database connections were always closed, regardless of the 'pconnect' option value.
+- Fixed a bug (#128) - :doc:`Language Library <libraries/language>` did not correctly keep track of loaded language files.
+- Fixed a bug (#1242) - Added Windows path compatibility to function read_dir of ZIP library.
+- Fixed a bug (#1314) - sess_destroy() did not destroy userdata.
+- Fixed a bug (#1349) - get_extension() in the :doc:`File Uploading Library <libraries/file_uploading>` returned the original filename when it didn't have an actual extension.
+- Fixed a bug (#1273) - E_NOTICE being generated by :doc:`Query Builder <database/query_builder>`'s set_update_batch() method.
+- Fixed a bug (#44, #110) - :doc:`Upload library <libraries/file_uploading>`'s clean_file_name() method didn't clear '!' and '#' characters.
+- Fixed a bug (#121) - ``CI_DB_result::row()`` returned an array when there's no actual result to be returned.
+- Fixed a bug (#319) - SQLSRV's affected_rows() method failed due to a scrollable cursor being created for write-type queries.
+- Fixed a bug (#356) - PostgreSQL driver didn't have an _update_batch() method, which resulted in fatal error being triggered when update_batch() is used with it.
+- Fixed a bug (#862) - create_table() failed on SQLSRV/MSSQL when used with 'IF NOT EXISTS'.
+- Fixed a bug (#1419) - libraries/Driver.php had a static variable that was causing an error.
+- Fixed a bug (#1411) - the :doc:`Email library <libraries/email>` used its own short list of MIMEs instead the one from config/mimes.php.
+- Fixed a bug where the magic_quotes_runtime setting wasn't turned off for PHP 5.3 (where it is indeed deprecated, but not non-existent).
+
+Version 2.1.1
+=============
+
+Release Date: Not Released
+
+- General Changes
+ - Fixed support for docx, xlsx files in mimes.php.
+
+- Libraries
+ - Further improved MIME type detection in the :doc:`File Uploading Library <libraries/file_uploading>`.
+
+- Helpers
+ - url_title() performance and output improved. You can now use any string as the word delimiter, but 'dash' and 'underscore' are still supported.
+
+Bug fixes for 2.1.1
+-------------------
+
+- Fixed a bug (#697) - A wrong array key was used in the Upload library to check for mime-types.
+- Fixed a bug - form_open() compared $action against site_url() instead of base_url().
+- Fixed a bug - CI_Upload::_file_mime_type() could've failed if mime_content_type() is used for the detection and returns FALSE.
+- Fixed a bug (#538) - Windows paths were ignored when using the :doc:`Image Manipulation Library <libraries/image_lib>` to create a new file.
+- Fixed a bug - When database caching was enabled, $this->db->query() checked the cache before binding variables which resulted in cached queries never being found.
+- Fixed a bug - CSRF cookie value was allowed to be any (non-empty) string before being written to the output, making code injection a risk.
+- Fixed a bug (#726) - PDO put a 'dbname' argument in it's connection string regardless of the database platform in use, which made it impossible to use SQLite.
Version 2.1.0
=============
-Release Date: Not Released
+Release Date: November 14, 2011
- General Changes
@@ -159,11 +317,9 @@ Release Date: Not Released
override them.
- Removed CI_CORE boolean constant from CodeIgniter.php (no longer Reactor and Core versions).
-
Bug fixes for 2.1.0
-------------------
-
- Fixed #378 Robots identified as regular browsers by the User Agent
class.
- If a config class was loaded first then a library with the same name
@@ -1162,7 +1318,7 @@ Bug fixes for 1.6.3
- Added a language key for valid_emails in validation_lang.php.
- Amended fixes for bug (#3419) with parsing DSN database connections.
-- Moved the _has_operators() function (#4535) into DB_driver from
+- Moved the _has_operator() function (#4535) into DB_driver from
DB_active_rec.
- Fixed a syntax error in upload_lang.php.
- Fixed a bug (#4542) with a regular expression in the Image library.
diff --git a/user_guide_src/source/conf.py b/user_guide_src/source/conf.py
index 593ceaf1c..e972a388b 100644
--- a/user_guide_src/source/conf.py
+++ b/user_guide_src/source/conf.py
@@ -121,7 +121,7 @@ html_theme_path = ["./_themes"]
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
-html_static_path = ['_static']
+#html_static_path = ['_static']
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
# using the given strftime format.
diff --git a/user_guide_src/source/database/configuration.rst b/user_guide_src/source/database/configuration.rst
index 4f88c25ab..7a19c840f 100644
--- a/user_guide_src/source/database/configuration.rst
+++ b/user_guide_src/source/database/configuration.rst
@@ -28,6 +28,10 @@ prototype::
$db['default']['autoinit'] = TRUE;
$db['default']['stricton'] = FALSE;
+If you use PDO as your dbdriver, you can specify the full DSN string describe a connection to the database like this::
+
+ $db['default']['dsn'] = 'pgsql:host=localhost;port=5432;dbname=database_name';
+
You can also specify failovers for the situation when the main connection cannot connect for some reason.
These failovers can be specified by setting the failover for a connection like this::
@@ -102,18 +106,18 @@ Note: The name "test" is arbitrary. It can be anything you want. By
default we've used the word "default" for the primary connection, but it
too can be renamed to something more relevant to your project.
-Active Record
+Query Builder
-------------
-The :doc:`Active Record Class <active_record>` is globally enabled or
-disabled by setting the $active_record variable in the database
+The :doc:`Query Builder Class <query_builder>` is globally enabled or
+disabled by setting the $query_builder variable in the database
configuration file to TRUE/FALSE (boolean). If you are not using the
-active record class, setting it to FALSE will utilize fewer resources
+query builder class, setting it to FALSE will utilize fewer resources
when the database classes are initialized.
::
- $active_record = TRUE;
+ $query_builder = TRUE;
.. note:: that some CodeIgniter classes such as Sessions require Active
Records be enabled to access certain functionality.
@@ -128,9 +132,9 @@ Explanation of Values:
**username** The username used to connect to the database.
**password** The password used to connect to the database.
**database** The name of the database you want to connect to.
-**dbdriver** The database type. ie: mysql, postgres, odbc, etc. Must be specified in lower case.
+**dbdriver** The database type. ie: mysql, postgre, odbc, etc. Must be specified in lower case.
**dbprefix** An optional table prefix which will added to the table name when running :doc:
- `Active Record <active_record>` queries. This permits multiple CodeIgniter installations
+ `Query Builder <query_builder>` queries. This permits multiple CodeIgniter installations
to share one database.
**pconnect** TRUE/FALSE (boolean) - Whether to use a persistent connection.
**db_debug** TRUE/FALSE (boolean) - Whether database errors should be displayed.
@@ -162,8 +166,8 @@ Explanation of Values:
$db['default']['port'] = 5432;
====================== ==================================================================================================
-.. note:: Depending on what database platform you are using (MySQL,
- Postgres, etc.) not all values will be needed. For example, when using
- SQLite you will not need to supply a username or password, and the
- database name will be the path to your database file. The information
- above assumes you are using MySQL.
+.. note:: Depending on what database platform you are using (MySQL, PostgreSQL,
+ etc.) not all values will be needed. For example, when using SQLite you
+ will not need to supply a username or password, and the database name
+ will be the path to your database file. The information above assumes
+ you are using MySQL.
diff --git a/user_guide_src/source/database/connecting.rst b/user_guide_src/source/database/connecting.rst
index a834cc0f7..5822ca62c 100644
--- a/user_guide_src/source/database/connecting.rst
+++ b/user_guide_src/source/database/connecting.rst
@@ -36,7 +36,7 @@ Available Parameters
string.
#. TRUE/FALSE (boolean). Whether to return the connection ID (see
Connecting to Multiple Databases below).
-#. TRUE/FALSE (boolean). Whether to enable the Active Record class. Set
+#. TRUE/FALSE (boolean). Whether to enable the Query Builder class. Set
to TRUE by default.
Manually Connecting to a Database
@@ -122,6 +122,12 @@ return the database object.
| $DB1->result();
| etc...
+.. note:: You don't need to create separate database configurations if you
+ only need to use a different database on the same connection. You
+ can switch to a different database when you need to, like this:
+
+ | $this->db->db_select($database2_name);
+
Reconnecting / Keeping the Connection Alive
===========================================
diff --git a/user_guide_src/source/database/examples.rst b/user_guide_src/source/database/examples.rst
index d1cd48837..8b3cc4701 100644
--- a/user_guide_src/source/database/examples.rst
+++ b/user_guide_src/source/database/examples.rst
@@ -104,10 +104,10 @@ Standard Insert
$this->db->query($sql);
echo $this->db->affected_rows();
-Active Record Query
+Query Builder Query
===================
-The :doc:`Active Record Pattern <active_record>` gives you a simplified
+The :doc:`Query Builder Pattern <query_builder>` gives you a simplified
means of retrieving data::
$query = $this->db->get('table_name');
@@ -118,10 +118,10 @@ means of retrieving data::
}
The above get() function retrieves all the results from the supplied
-table. The :doc:`Active Record <active_record>` class contains a full
+table. The :doc:`Query Builder <query_builder>` class contains a full
compliment of functions for working with data.
-Active Record Insert
+Query Builder Insert
====================
::
diff --git a/user_guide_src/source/database/helpers.rst b/user_guide_src/source/database/helpers.rst
index 7ea19e9f6..e8a5ac801 100644
--- a/user_guide_src/source/database/helpers.rst
+++ b/user_guide_src/source/database/helpers.rst
@@ -7,9 +7,9 @@ $this->db->insert_id()
The insert ID number when performing database inserts.
-.. note:: If using the PDO driver with PostgreSQL, this function requires
- a $name parameter, which specifies the appropriate sequence to check
- for the insert id.
+.. note:: If using the PDO driver with PostgreSQL, or using the Interbase
+ driver, this function requires a $name parameter, which specifies the
+ appropriate sequence to check for the insert id.
$this->db->affected_rows()
===========================
diff --git a/user_guide_src/source/database/index.rst b/user_guide_src/source/database/index.rst
index ab12b7cb7..7ccb8fb00 100644
--- a/user_guide_src/source/database/index.rst
+++ b/user_guide_src/source/database/index.rst
@@ -3,7 +3,7 @@ The Database Class
##################
CodeIgniter comes with a full-featured and very fast abstracted database
-class that supports both traditional structures and Active Record
+class that supports both traditional structures and Query Builder
patterns. The database functions offer clear, simple syntax.
.. toctree::
@@ -15,7 +15,7 @@ patterns. The database functions offer clear, simple syntax.
Running Queries <queries>
Generating Query Results <results>
Query Helper Functions <helpers>
- Active Record Class <active_record>
+ Query Builder Class <query_builder>
Transactions <transactions>
Table MetaData <table_data>
Field MetaData <fields>
diff --git a/user_guide_src/source/database/queries.rst b/user_guide_src/source/database/queries.rst
index 971d5d61d..d23efecb3 100644
--- a/user_guide_src/source/database/queries.rst
+++ b/user_guide_src/source/database/queries.rst
@@ -50,7 +50,7 @@ Protecting identifiers
**********************
In many databases it is advisable to protect table and field names - for
-example with backticks in MySQL. **Active Record queries are
+example with backticks in MySQL. **Query Builder queries are
automatically protected**, however if you need to manually protect an
identifier you can use::
@@ -112,3 +112,20 @@ The secondary benefit of using binds is that the values are
automatically escaped, producing safer queries. You don't have to
remember to manually escape data; the engine does it automatically for
you.
+
+***************
+Handling Errors
+***************
+
+$this->db->error();
+===================
+
+If you need to get the last error that has occured, the error() method
+will return an array containing its code and message. Here's a quick
+example::
+
+ if ( ! $this->db->simple_query('SELECT `example_field` FROM `example_table`'))
+ {
+ $error = $this->db->error(); // Has keys 'code' and 'message'
+ }
+
diff --git a/user_guide_src/source/database/active_record.rst b/user_guide_src/source/database/query_builder.rst
index c04e67d2a..54e8df6b5 100644
--- a/user_guide_src/source/database/active_record.rst
+++ b/user_guide_src/source/database/query_builder.rst
@@ -1,15 +1,15 @@
###################
-Active Record Class
+Query Builder Class
###################
-CodeIgniter uses a modified version of the Active Record Database
-Pattern. This pattern allows information to be retrieved, inserted, and
-updated in your database with minimal scripting. In some cases only one
-or two lines of code are necessary to perform a database action.
+CodeIgniter gives you access to a Query Builder class. This pattern
+allows information to be retrieved, inserted, and updated in your
+database with minimal scripting. In some cases only one or two lines
+of code are necessary to perform a database action.
CodeIgniter does not require that each database table be its own class
file. It instead provides a more simplified interface.
-Beyond simplicity, a major benefit to using the Active Record features
+Beyond simplicity, a major benefit to using the Query Builder features
is that it allows you to create database independent applications, since
the query syntax is generated by each database adapter. It also allows
for safer queries, since the values are escaped automatically by the
@@ -67,7 +67,7 @@ Example::
// Produces string: SELECT * FROM mytable
-The second parameter enables you to set whether or not the active record query
+The second parameter enables you to set whether or not the query builder query
will be reset (by default it will be&mdash;just like `$this->db->get()`)::
echo $this->db->limit(10,20)->get_compiled_select('mytable', FALSE);
@@ -512,7 +512,7 @@ $this->db->count_all_results()
==============================
Permits you to determine the number of rows in a particular Active
-Record query. Queries will accept Active Record restrictors such as
+Record query. Queries will accept Query Builder restrictors such as
where(), or_where(), like(), or_like(), etc. Example::
echo $this->db->count_all_results('my_table'); // Produces an integer, like 25
@@ -533,7 +533,7 @@ Query grouping
**************
Query grouping allows you to create groups of WHERE clauses by enclosing them in parentheses. This will allow
-you to create queries with complex WHERE clauses. Nested groups are supported. Example:
+you to create queries with complex WHERE clauses. Nested groups are supported. Example::
$this->db->select('*')->from('my_table')
->group_start()
@@ -636,7 +636,7 @@ Example::
// Produces string: INSERT INTO mytable (title, name, date) VALUES ('My title', 'My name', 'My date')
-The second parameter enables you to set whether or not the active record query
+The second parameter enables you to set whether or not the query builder query
will be reset (by default it will be--just like `$this->db->insert()`_)::
echo $this->db->set('title', 'My Title')->get_compiled_insert('mytable', FALSE);
@@ -921,19 +921,19 @@ Method chaining allows you to simplify your syntax by connecting
multiple functions. Consider this example::
$query = $this->db->select('title')
- ->where('id', $id)
- ->limit(10, 20)
- ->get('mytable');
+ ->where('id', $id)
+ ->limit(10, 20)
+ ->get('mytable');
.. _ar-caching:
*********************
-Active Record Caching
+Query Builder Caching
*********************
-While not "true" caching, Active Record enables you to save (or "cache")
+While not "true" caching, Query Builder enables you to save (or "cache")
certain parts of your queries for reuse at a later point in your
-script's execution. Normally, when an Active Record call is completed,
+script's execution. Normally, when an Query Builder call is completed,
all stored information is reset for the next call. With caching, you can
prevent this reset, and reuse information easily.
@@ -944,7 +944,7 @@ There are three Caching functions available:
$this->db->start_cache()
========================
-This function must be called to begin caching. All Active Record queries
+This function must be called to begin caching. All Query Builder queries
of the correct type (see below for supported queries) are stored for
later use.
@@ -956,7 +956,7 @@ This function can be called to stop caching.
$this->db->flush_cache()
========================
-This function deletes all items from the Active Record cache.
+This function deletes all items from the Query Builder cache.
Here's a usage example::
@@ -983,12 +983,12 @@ Here's a usage example::
$this->db->reset_query()
========================
-Resetting Active Record allows you to start fresh with your query without
+Resetting Query Builder allows you to start fresh with your query without
executing it first using a method like $this->db->get() or $this->db->insert().
Just like the methods that execute a query, this will *not* reset items you've
-cached using `Active Record Caching`_.
+cached using `Query Builder Caching`_.
-This is useful in situations where you are using Active Record to generate SQL
+This is useful in situations where you are using Query Builder to generate SQL
(ex. ``$this->db->get_compiled_select()``) but then choose to, for instance,
run the query::
diff --git a/user_guide_src/source/database/results.rst b/user_guide_src/source/database/results.rst
index 4f93c794d..ac4fc3733 100644
--- a/user_guide_src/source/database/results.rst
+++ b/user_guide_src/source/database/results.rst
@@ -136,6 +136,26 @@ parameter:
| **$row = $query->next_row('array')**
| **$row = $query->previous_row('array')**
+.. note:: all the functions above will load the whole result into memory (prefetching) use unbuffered_row() for processing large result sets.
+
+unbuffered_row($type)
+=====
+
+This function returns a single result row without prefetching the whole result in memory as row() does.
+If your query has more than one row, it returns the current row and moves the internal data pointer ahead.
+The result is returned as $type could be 'object' (default) or 'array' that will return an associative array.
+
+
+
+ $query = $this->db->query("YOUR QUERY");
+
+ while ($row = $query->unbuffered_row())
+ {
+ echo $row->title;
+ echo $row->name;
+ echo $row->body;
+ }
+
***********************
Result Helper Functions
***********************
@@ -150,6 +170,12 @@ is the variable that the query result object is assigned to::
echo $query->num_rows();
+.. note::
+ Not all database drivers have a native way of getting the total
+ number of rows for a result set. When this is the case, all of
+ the data is prefetched and count() is manually called on the
+ resulting array in order to achieve the same functionality.
+
$query->num_fields()
=====================
@@ -182,5 +208,4 @@ Example::
$row = $query2->row();
echo $row->name;
- $query2->free_result();// The $query2 result object will no longer be available
-
+ $query2->free_result(); // The $query2 result object will no longer be available
diff --git a/user_guide_src/source/database/utilities.rst b/user_guide_src/source/database/utilities.rst
index b0920109f..4e83929b2 100644
--- a/user_guide_src/source/database/utilities.rst
+++ b/user_guide_src/source/database/utilities.rst
@@ -117,7 +117,7 @@ query. Example::
echo $this->dbutil->csv_from_result($query);
The second, third, and fourth parameters allow you to set the delimiter
-newline, and enclosure characters respectively. By default tabs are
+newline, and enclosure characters respectively. By default commas are
used as the delimiter, "\n" is used as a new line, and a double-quote
is used as the enclosure. Example::
@@ -161,7 +161,11 @@ $this->dbutil->backup()
Permits you to backup your full database or individual tables. The
backup data can be compressed in either Zip or Gzip format.
-.. note:: This features is only available for MySQL databases.
+.. note:: This features is only available for MySQL and Interbase/Firebird databases.
+
+.. note:: For Interbase/Firebird databases, the backup file name is the only parameter.
+
+ Eg. $this->dbutil->backup('db_backup_filename');
.. note:: Due to the limited execution time and memory available to PHP,
backing up very large databases may not be possible. If your database is
diff --git a/user_guide_src/source/general/common_functions.rst b/user_guide_src/source/general/common_functions.rst
index 70563b8d2..99126f900 100644
--- a/user_guide_src/source/general/common_functions.rst
+++ b/user_guide_src/source/general/common_functions.rst
@@ -79,3 +79,8 @@ html_escape($mixed)
This function provides short cut for htmlspecialchars() function. It
accepts string and array. To prevent Cross Site Scripting (XSS), it is
very useful.
+
+get_mimes()
+=============
+
+This function returns the MIMEs array from config/mimes.php. \ No newline at end of file
diff --git a/user_guide_src/source/general/creating_libraries.rst b/user_guide_src/source/general/creating_libraries.rst
index bc545b483..673fbd4bb 100644
--- a/user_guide_src/source/general/creating_libraries.rst
+++ b/user_guide_src/source/general/creating_libraries.rst
@@ -188,17 +188,23 @@ application/libraries/MY_Email.php, and declare your class with::
}
-Note: If you need to use a constructor in your class make sure you
+If you need to use a constructor in your class make sure you
extend the parent constructor::
class MY_Email extends CI_Email {
- public function __construct()
- {
- parent::__construct();
- }
+ public function __construct($config = array())
+ {
+ parent::__construct($config);
+ }
+
}
+.. note::
+ Not all of the libraries have the same (or any) parameters
+ in their constructor. Take a look at the library that you're
+ extending first to see how it should be implemented.
+
Loading Your Sub-class
----------------------
diff --git a/user_guide_src/source/general/environments.rst b/user_guide_src/source/general/environments.rst
index 40725feba..fa1b096e2 100644
--- a/user_guide_src/source/general/environments.rst
+++ b/user_guide_src/source/general/environments.rst
@@ -11,10 +11,16 @@ when "live".
The ENVIRONMENT Constant
========================
-By default, CodeIgniter comes with the environment constant set to
+By default, CodeIgniter comes with the environment constant set to use
+the value provided in ``$_SERVER['CI_ENV']``, otherwise defaults to
'development'. At the top of index.php, you will see::
- define('ENVIRONMENT', 'development');
+ define('ENVIRONMENT', isset($_SERVER['CI_ENV']) ? $_SERVER['CI_ENV'] : 'development');
+
+This server variable can be set in your .htaccess file, or Apache
+config using `SetEnv <https://httpd.apache.org/docs/2.2/mod/mod_env.html#setenv>`_.
+Alternative methods are available for nginx and other servers, or you can
+remove this logic entirely and set the constant based on the HTTP_HOST or IP.
In addition to affecting some basic framework behavior (see the next
section), you may use this constant in your own development to
diff --git a/user_guide_src/source/general/models.rst b/user_guide_src/source/general/models.rst
index b816f958a..87f63e416 100644
--- a/user_guide_src/source/general/models.rst
+++ b/user_guide_src/source/general/models.rst
@@ -16,7 +16,7 @@ blog. You might have a model class that contains functions to insert,
update, and retrieve your blog data. Here is an example of what such a
model class might look like::
- class Blogmodel extends CI_Model {
+ class Blog_model extends CI_Model {
var $title = '';
var $content = '';
@@ -55,7 +55,7 @@ model class might look like::
}
.. note:: The functions in the above example use the :doc:`Active
- Record <../database/active_record>` database functions.
+ Record <../database/query_builder>` database functions.
.. note:: For the sake of simplicity in this example we're using $_POST
directly. This is generally bad practice, and a more common approach
@@ -104,7 +104,7 @@ Your models will typically be loaded and called from within your
:doc:`controller <controllers>` functions. To load a model you will use
the following function::
- $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
@@ -115,14 +115,14 @@ application/models/blog/queries.php you'll load it using::
Once loaded, you will access your model functions using an object with
the same name as your class::
- $this->load->model('Model_name');
+ $this->load->model('model_name');
- $this->Model_name->function();
+ $this->model_name->function();
If you would like your model assigned to a different object name you can
specify it via the second parameter of the loading function::
- $this->load->model('Model_name', 'fubar');
+ $this->load->model('model_name', 'fubar');
$this->fubar->function();
@@ -133,7 +133,7 @@ view::
function blog()
{
- $this->load->model('Blog');
+ $this->load->model('blog');
$data['query'] = $this->Blog->get_last_ten_entries();
@@ -165,7 +165,7 @@ database. The following options for connecting are available to you:
defined in your database config file will be used:
::
- $this->load->model('Model_name', '', TRUE);
+ $this->load->model('model_name', '', TRUE);
- You can manually pass database connectivity settings via the third
parameter::
diff --git a/user_guide_src/source/general/requirements.rst b/user_guide_src/source/general/requirements.rst
index 38623557d..d97b7b4b2 100644
--- a/user_guide_src/source/general/requirements.rst
+++ b/user_guide_src/source/general/requirements.rst
@@ -2,7 +2,7 @@
Server Requirements
###################
-- `PHP <http://www.php.net/>`_ version 5.1.6 or newer.
+- `PHP <http://www.php.net/>`_ version 5.2.4 or newer.
- A Database is required for most web application programming. Current
- supported databases are MySQL (4.1+), MySQLi, MS SQL, Postgres, Oracle,
- SQLite, ODBC and CUBRID. \ No newline at end of file
+ supported databases are MySQL (5.1+), MySQLi, MS SQL, SQLSRV, Oracle,
+ PostgreSQL, SQLite, SQLite3, CUBRID, Interbase, ODBC and PDO.
diff --git a/user_guide_src/source/general/styleguide.rst b/user_guide_src/source/general/styleguide.rst
index b3dc08871..925954c03 100644
--- a/user_guide_src/source/general/styleguide.rst
+++ b/user_guide_src/source/general/styleguide.rst
@@ -94,7 +94,7 @@ overly long and verbose names.
class Super_class {
- function __construct()
+ public function __construct()
{
}
@@ -149,7 +149,7 @@ months down the line. There is not a required format for comments, but
the following are recommended.
`DocBlock <http://manual.phpdoc.org/HTMLSmartyConverter/HandS/phpDocumentor/tutorial_phpDocumentor.howto.pkg.html#basics.docblock>`_
-style comments preceding class and method declarations so they can be
+style comments preceding class, method, and property declarations so they can be
picked up by IDEs::
/**
@@ -168,11 +168,21 @@ picked up by IDEs::
/**
* Encodes string for use in XML
*
- * @access public
* @param string
* @return string
*/
function xml_encode($str)
+
+::
+
+ /**
+ * Data for class manipulation
+ *
+ * @var array
+ */
+ public $data
+
+
Use single line comments within code, leaving a blank line between large
comment blocks and code.
@@ -441,6 +451,13 @@ same level as the control statement that "owns" them.
// ...
}
}
+
+ try {
+ // ...
+ }
+ catch() {
+ // ...
+ }
**CORRECT**::
@@ -470,6 +487,15 @@ same level as the control statement that "owns" them.
// ...
}
}
+
+ try
+ {
+ // ...
+ }
+ catch()
+ {
+ // ...
+ }
Bracket and Parenthetic Spacing
===============================
diff --git a/user_guide_src/source/general/urls.rst b/user_guide_src/source/general/urls.rst
index 857078b1c..6b390b559 100644
--- a/user_guide_src/source/general/urls.rst
+++ b/user_guide_src/source/general/urls.rst
@@ -39,9 +39,10 @@ By default, the **index.php** file will be included in your URLs::
example.com/index.php/news/article/my_article
-You can easily remove this file by using a .htaccess file with some
-simple rules. Here is an example of such a file, using the "negative"
-method in which everything is redirected except the specified items:
+If your Apache server has mod_rewrite enabled, you can easily remove this
+file by using a .htaccess file with some simple rules. Here is an example
+of such a file, using the "negative" method in which everything is redirected
+except the specified items:
::
@@ -53,6 +54,8 @@ method in which everything is redirected except the specified items:
In the above example, any HTTP request other than those for existing
directories and existing files is treated as a request for your index.php file.
+.. note:: Note: These specific rules might not work for all server configurations.
+
Adding a URL Suffix
===================
diff --git a/user_guide_src/source/general/views.rst b/user_guide_src/source/general/views.rst
index dc65f6c4f..9b7c9daaa 100644
--- a/user_guide_src/source/general/views.rst
+++ b/user_guide_src/source/general/views.rst
@@ -49,7 +49,7 @@ replace the echo statement with the view loading function::
<?php
class Blog extends CI_Controller {
- function index()
+ public function index()
{
$this->load->view('blogview');
}
@@ -74,14 +74,14 @@ might look something like this::
class Page extends CI_Controller {
- function index()
- {
- $data['page_title'] = 'Your title';
- $this->load->view('header');
- $this->load->view('menu');
- $this->load->view('content', $data);
- $this->load->view('footer');
- }
+ public function index()
+ {
+ $data['page_title'] = 'Your title';
+ $this->load->view('header');
+ $this->load->view('menu');
+ $this->load->view('content', $data);
+ $this->load->view('footer');
+ }
}
?>
@@ -126,7 +126,7 @@ Let's try it with your controller file. Open it add this code::
<?php
class Blog extends CI_Controller {
- function index()
+ public function index()
{
$data['title'] = "My Real Title";
$data['heading'] = "My Real Heading";
@@ -164,7 +164,7 @@ Here's a simple example. Add this to your controller::
<?php
class Blog extends CI_Controller {
- function index()
+ public function index()
{
$data['todo_list'] = array('Clean House', 'Call Mom', 'Run Errands');
diff --git a/user_guide_src/source/helpers/date_helper.rst b/user_guide_src/source/helpers/date_helper.rst
index ad06dd628..18216c5a2 100644
--- a/user_guide_src/source/helpers/date_helper.rst
+++ b/user_guide_src/source/helpers/date_helper.rst
@@ -255,14 +255,16 @@ Formats a unix timestamp so that is appears similar to this
The first parameter must contain a Unix timestamp. The second parameter
must contain a timestamp that is greater that the first timestamp. If
-the second parameter empty, the current time will be used. The most
-common purpose for this function is to show how much time has elapsed
-from some point in time in the past to now.
+the second parameter empty, the current time will be used. The third
+parameter is optional and limits the number of time units to display.
+The most common purpose for this function is to show how much time has
+elapsed from some point in time in the past to now.
-.. php:method:: timespan($seconds = 1, $time = '')
+.. php:method:: timespan($seconds = 1, $time = '', $units = '')
:param integer $seconds: a number of seconds
:param string $time: Unix timestamp
+ :param integer $units: a number of time units to display
:returns: string
Example
@@ -271,7 +273,8 @@ Example
$post_date = '1079621429';
$now = time();
- echo timespan($post_date, $now);
+ $units = 2;
+ echo timespan($post_date, $now, $units);
.. note:: The text generated by this function is found in the following language
file: language/<your_lang>/date_lang.php
@@ -327,36 +330,46 @@ Generates a pull-down menu of timezones, like this one:
<form action="#">
<select name="timezones">
- <option value='UM12'>(UTC - 12:00) Enitwetok, Kwajalien</option>
- <option value='UM11'>(UTC - 11:00) Nome, Midway Island, Samoa</option>
- <option value='UM10'>(UTC - 10:00) Hawaii</option>
- <option value='UM9'>(UTC - 9:00) Alaska</option>
- <option value='UM8'>(UTC - 8:00) Pacific Time</option>
- <option value='UM7'>(UTC - 7:00) Mountain Time</option>
- <option value='UM6'>(UTC - 6:00) Central Time, Mexico City</option>
- <option value='UM5'>(UTC - 5:00) Eastern Time, Bogota, Lima, Quito</option>
- <option value='UM4'>(UTC - 4:00) Atlantic Time, Caracas, La Paz</option>
- <option value='UM25'>(UTC - 3:30) Newfoundland</option>
- <option value='UM3'>(UTC - 3:00) Brazil, Buenos Aires, Georgetown, Falkland Is.</option>
- <option value='UM2'>(UTC - 2:00) Mid-Atlantic, Ascention Is., St Helena</option>
- <option value='UM1'>(UTC - 1:00) Azores, Cape Verde Islands</option>
- <option value='UTC' selected='selected'>(UTC) Casablanca, Dublin, Edinburgh, London, Lisbon, Monrovia</option>
- <option value='UP1'>(UTC + 1:00) Berlin, Brussels, Copenhagen, Madrid, Paris, Rome</option>
- <option value='UP2'>(UTC + 2:00) Kaliningrad, South Africa, Warsaw</option>
- <option value='UP3'>(UTC + 3:00) Baghdad, Riyadh, Moscow, Nairobi</option>
- <option value='UP25'>(UTC + 3:30) Tehran</option>
- <option value='UP4'>(UTC + 4:00) Adu Dhabi, Baku, Muscat, Tbilisi</option>
- <option value='UP35'>(UTC + 4:30) Kabul</option>
- <option value='UP5'>(UTC + 5:00) Islamabad, Karachi, Tashkent</option>
- <option value='UP45'>(UTC + 5:30) Bombay, Calcutta, Madras, New Delhi</option>
- <option value='UP6'>(UTC + 6:00) Almaty, Colomba, Dhaka</option>
- <option value='UP7'>(UTC + 7:00) Bangkok, Hanoi, Jakarta</option>
- <option value='UP8'>(UTC + 8:00) Beijing, Hong Kong, Perth, Singapore, Taipei</option>
- <option value='UP9'>(UTC + 9:00) Osaka, Sapporo, Seoul, Tokyo, Yakutsk</option>
- <option value='UP85'>(UTC + 9:30) Adelaide, Darwin</option>
- <option value='UP10'>(UTC + 10:00) Melbourne, Papua New Guinea, Sydney, Vladivostok</option>
- <option value='UP11'>(UTC + 11:00) Magadan, New Caledonia, Solomon Islands</option>
- <option value='UP12'>(UTC + 12:00) Auckland, Wellington, Fiji, Marshall Island</option>
+ <option value='UM12'>(UTC -12:00) Baker/Howland Island</option>
+ <option value='UM11'>(UTC -11:00) Samoa Time Zone, Niue</option>
+ <option value='UM10'>(UTC -10:00) Hawaii-Aleutian Standard Time, Cook Islands, Tahiti</option>
+ <option value='UM95'>(UTC -9:30) Marquesas Islands</option>
+ <option value='UM9'>(UTC -9:00) Alaska Standard Time, Gambier Islands</option>
+ <option value='UM8'>(UTC -8:00) Pacific Standard Time, Clipperton Island</option>
+ <option value='UM7'>(UTC -7:00) Mountain Standard Time</option>
+ <option value='UM6'>(UTC -6:00) Central Standard Time</option>
+ <option value='UM5'>(UTC -5:00) Eastern Standard Time, Western Caribbean Standard Time</option>
+ <option value='UM45'>(UTC -4:30) Venezuelan Standard Time</option>
+ <option value='UM4'>(UTC -4:00) Atlantic Standard Time, Eastern Caribbean Standard Time</option>
+ <option value='UM35'>(UTC -3:30) Newfoundland Standard Time</option>
+ <option value='UM3'>(UTC -3:00) Argentina, Brazil, French Guiana, Uruguay</option>
+ <option value='UM2'>(UTC -2:00) South Georgia/South Sandwich Islands</option>
+ <option value='UM1'>(UTC -1:00) Azores, Cape Verde Islands</option>
+ <option value='UTC' selected='selected'>(UTC) Greenwich Mean Time, Western European Time</option>
+ <option value='UP1'>(UTC +1:00) Central European Time, West Africa Time</option>
+ <option value='UP2'>(UTC +2:00) Central Africa Time, Eastern European Time, Kaliningrad Time</option>
+ <option value='UP3'>(UTC +3:00) Moscow Time, East Africa Time</option>
+ <option value='UP35'>(UTC +3:30) Iran Standard Time</option>
+ <option value='UP4'>(UTC +4:00) Azerbaijan Standard Time, Samara Time</option>
+ <option value='UP45'>(UTC +4:30) Afghanistan</option>
+ <option value='UP5'>(UTC +5:00) Pakistan Standard Time, Yekaterinburg Time</option>
+ <option value='UP55'>(UTC +5:30) Indian Standard Time, Sri Lanka Time</option>
+ <option value='UP575'>(UTC +5:45) Nepal Time</option>
+ <option value='UP6'>(UTC +6:00) Bangladesh Standard Time, Bhutan Time, Omsk Time</option>
+ <option value='UP65'>(UTC +6:30) Cocos Islands, Myanmar</option>
+ <option value='UP7'>(UTC +7:00) Krasnoyarsk Time, Cambodia, Laos, Thailand, Vietnam</option>
+ <option value='UP8'>(UTC +8:00) Australian Western Standard Time, Beijing Time, Irkutsk Time</option>
+ <option value='UP875'>(UTC +8:45) Australian Central Western Standard Time</option>
+ <option value='UP9'>(UTC +9:00) Japan Standard Time, Korea Standard Time, Yakutsk Time</option>
+ <option value='UP95'>(UTC +9:30) Australian Central Standard Time</option>
+ <option value='UP10'>(UTC +10:00) Australian Eastern Standard Time, Vladivostok Time</option>
+ <option value='UP105'>(UTC +10:30) Lord Howe Island</option>
+ <option value='UP11'>(UTC +11:00) Magadan Time, Solomon Islands, Vanuatu</option>
+ <option value='UP115'>(UTC +11:30) Norfolk Island</option>
+ <option value='UP12'>(UTC +12:00) Fiji, Gilbert Islands, Kamchatka Time, New Zealand Standard Time</option>
+ <option value='UP1275'>(UTC +12:45) Chatham Islands Standard Time</option>
+ <option value='UP13'>(UTC +13:00) Phoenix Islands Time, Tonga</option>
+ <option value='UP14'>(UTC +14:00) Line Islands</option>
</select>
</form>
@@ -393,66 +406,88 @@ Timezone Reference
The following table indicates each timezone and its location.
+Note some of the location lists have been abridged for clarity and formatting.
+
+------------+----------------------------------------------------------------+
| Time Zone | Location |
+============+================================================================+
-| UM12 | (UTC - 12:00) Enitwetok, Kwajalien |
+| UM12 | (UTC - 12:00) Baker/Howland Island |
++------------+----------------------------------------------------------------+
+| UM11 | (UTC - 11:00) Samoa Time Zone, Niue |
++------------+----------------------------------------------------------------+
+| UM10 | (UTC - 10:00) Hawaii-Aleutian Standard Time, Cook Islands |
++------------+----------------------------------------------------------------+
+| UM95 | (UTC - 09:30) Marquesas Islands |
++------------+----------------------------------------------------------------+
+| UM9 | (UTC - 09:00) Alaska Standard Time, Gambier Islands |
++------------+----------------------------------------------------------------+
+| UM8 | (UTC - 08:00) Pacific Standard Time, Clipperton Island |
++------------+----------------------------------------------------------------+
+| UM7 | (UTC - 11:00) Mountain Standard Time |
++------------+----------------------------------------------------------------+
+| UM6 | (UTC - 06:00) Central Standard Time |
++------------+----------------------------------------------------------------+
+| UM5 | (UTC - 05:00) Eastern Standard Time, Western Caribbean |
++------------+----------------------------------------------------------------+
+| UM45 | (UTC - 04:30) Venezuelan Standard Time |
++------------+----------------------------------------------------------------+
+| UM4 | (UTC - 04:00) Atlantic Standard Time, Eastern Caribbean |
+------------+----------------------------------------------------------------+
-| UM11 | (UTC - 11:00) Nome, Midway Island, Samoa |
+| UM35 | (UTC - 03:30) Newfoundland Standard Time |
+------------+----------------------------------------------------------------+
-| UM10 | (UTC - 10:00) Hawaii |
+| UM3 | (UTC - 03:00) Argentina, Brazil, French Guiana, Uruguay |
+------------+----------------------------------------------------------------+
-| UM9 | (UTC - 9:00) Alaska |
+| UM2 | (UTC - 02:00) South Georgia/South Sandwich Islands |
+------------+----------------------------------------------------------------+
-| UM8 | (UTC - 8:00) Pacific Time |
+| UM1 | (UTC -1:00) Azores, Cape Verde Islands |
+------------+----------------------------------------------------------------+
-| UM7 | (UTC - 7:00) Mountain Time |
+| UTC | (UTC) Greenwich Mean Time, Western European Time |
+------------+----------------------------------------------------------------+
-| UM6 | (UTC - 6:00) Central Time, Mexico City |
+| UP1 | (UTC +1:00) Central European Time, West Africa Time |
+------------+----------------------------------------------------------------+
-| UM5 | (UTC - 5:00) Eastern Time, Bogota, Lima, Quito |
+| UP2 | (UTC +2:00) Central Africa Time, Eastern European Time |
+------------+----------------------------------------------------------------+
-| UM4 | (UTC - 4:00) Atlantic Time, Caracas, La Paz |
+| UP3 | (UTC +3:00) Moscow Time, East Africa Time |
+------------+----------------------------------------------------------------+
-| UM25 | (UTC - 3:30) Newfoundland |
+| UP35 | (UTC +3:30) Iran Standard Time |
+------------+----------------------------------------------------------------+
-| UM3 | (UTC - 3:00) Brazil, Buenos Aires, Georgetown, Falkland Is. |
+| UP4 | (UTC +4:00) Azerbaijan Standard Time, Samara Time |
+------------+----------------------------------------------------------------+
-| UM2 | (UTC - 2:00) Mid-Atlantic, Ascention Is., St Helena |
+| UP45 | (UTC +4:30) Afghanistan |
+------------+----------------------------------------------------------------+
-| UM1 | (UTC - 1:00) Azores, Cape Verde Islands |
+| UP5 | (UTC +5:00) Pakistan Standard Time, Yekaterinburg Time |
+------------+----------------------------------------------------------------+
-| UTC | (UTC) Casablanca, Dublin, Edinburgh, London, Lisbon, Monrovia |
+| UP55 | (UTC +5:30) Indian Standard Time, Sri Lanka Time |
+------------+----------------------------------------------------------------+
-| UP1 | (UTC + 1:00) Berlin, Brussels, Copenhagen, Madrid, Paris, Rome |
+| UP575 | (UTC +5:45) Nepal Time |
+------------+----------------------------------------------------------------+
-| UP2 | (UTC + 2:00) Kaliningrad, South Africa, Warsaw |
+| UP6 | (UTC +6:00) Bangladesh Standard Time, Bhutan Time, Omsk Time |
+------------+----------------------------------------------------------------+
-| UP3 | (UTC + 3:00) Baghdad, Riyadh, Moscow, Nairobi |
+| UP65 | (UTC +6:30) Cocos Islands, Myanmar |
+------------+----------------------------------------------------------------+
-| UP25 | (UTC + 3:30) Tehran |
+| UP7 | (UTC +7:00) Krasnoyarsk Time, Cambodia, Laos, Thailand, Vietnam|
+------------+----------------------------------------------------------------+
-| UP4 | (UTC + 4:00) Adu Dhabi, Baku, Muscat, Tbilisi |
+| UP8 | (UTC +8:00) Australian Western Standard Time, Beijing Time |
+------------+----------------------------------------------------------------+
-| UP35 | (UTC + 4:30) Kabul |
+| UP875 | (UTC +8:45) Australian Central Western Standard Time |
+------------+----------------------------------------------------------------+
-| UP5 | (UTC + 5:00) Islamabad, Karachi, Tashkent |
+| UP9 | (UTC +9:00) Japan Standard Time, Korea Standard Time, Yakutsk |
+------------+----------------------------------------------------------------+
-| UP45 | (UTC + 5:30) Bombay, Calcutta, Madras, New Delhi |
+| UP95 | (UTC +9:30) Australian Central Standard Time |
+------------+----------------------------------------------------------------+
-| UP6 | (UTC + 6:00) Almaty, Colomba, Dhaka |
+| UP10 | (UTC +10:00) Australian Eastern Standard Time, Vladivostok Time|
+------------+----------------------------------------------------------------+
-| UP7 | (UTC + 7:00) Bangkok, Hanoi, Jakarta |
+| UP105 | (UTC +10:30) Lord Howe Island |
+------------+----------------------------------------------------------------+
-| UP8 | (UTC + 8:00) Beijing, Hong Kong, Perth, Singapore, Taipei |
+| UP11 | (UTC +11:00) Magadan Time, Solomon Islands, Vanuatu |
+------------+----------------------------------------------------------------+
-| UP9 | (UTC + 9:00) Osaka, Sapporo, Seoul, Tokyo, Yakutsk |
+| UP115 | (UTC +11:30) Norfolk Island |
+------------+----------------------------------------------------------------+
-| UP85 | (UTC + 9:30) Adelaide, Darwin |
+| UP12 | (UTC +12:00) Fiji, Gilbert Islands, Kamchatka, New Zealand |
+------------+----------------------------------------------------------------+
-| UP10 | (UTC + 10:00) Melbourne, Papua New Guinea, Sydney, Vladivostok |
+| UP1275 | (UTC +12:45) Chatham Islands Standard Time |
+------------+----------------------------------------------------------------+
-| UP11 | (UTC + 11:00) Magadan, New Caledonia, Solomon Islands |
+| UP13 | (UTC +13:00) Phoenix Islands Time, Tonga |
+------------+----------------------------------------------------------------+
-| UP12 | (UTC + 12:00) Auckland, Wellington, Fiji, Marshall Island |
+| UP14 | (UTC +14:00) Line Islands |
+------------+----------------------------------------------------------------+
diff --git a/user_guide_src/source/helpers/directory_helper.rst b/user_guide_src/source/helpers/directory_helper.rst
index fd169886c..cf88732d3 100644
--- a/user_guide_src/source/helpers/directory_helper.rst
+++ b/user_guide_src/source/helpers/directory_helper.rst
@@ -59,7 +59,7 @@ be numerically indexed. Here is an example of a typical array::
[1] => config.html        
[database] => Array
(              
- [0] => active_record.html              
+ [0] => query_builder.html              
[1] => binds.html              
[2] => configuration.html
[3] => connecting.html              
diff --git a/user_guide_src/source/helpers/form_helper.rst b/user_guide_src/source/helpers/form_helper.rst
index 3794e0835..a110f3c14 100644
--- a/user_guide_src/source/helpers/form_helper.rst
+++ b/user_guide_src/source/helpers/form_helper.rst
@@ -45,7 +45,7 @@ parameter, like this
::
- $attributes = array('class' => 'email', 'id' => 'myform');
+ $attributes = array('class' => 'email', 'id' => 'myform');
echo form_open('email/send', $attributes);
The above example would create a form similar to this
@@ -61,15 +61,15 @@ Hidden fields can be added by passing an associative array to the third paramete
::
- $hidden = array('username' => 'Joe', 'member_id' => '234');
+ $hidden = array('username' => 'Joe', 'member_id' => '234');
echo form_open('email/send', '', $hidden);
The above example would create a form similar to this
::
- <form method="post" accept-charset="utf-8" action="http://example.com/index.php/email/send">
- <input type="hidden" name="username" value="Joe" />
+ <form method="post" accept-charset="utf-8" action="http://example.com/index.php/email/send">
+ <input type="hidden" name="username" value="Joe" />
<input type="hidden" name="member_id" value="234" />
form_open_multipart()
@@ -87,28 +87,67 @@ name/value string to create one field
::
- form_hidden('username', 'johndoe');
+ form_hidden('username', 'johndoe');
// Would produce: <input type="hidden" name="username" value="johndoe" />
Or you can submit an associative array to create multiple fields
::
- $data = array(               
- 'name'  => 'John Doe',               
- 'email' => 'john@example.com',               
- 'url'   => 'http://example.com'             
- );
-
- echo form_hidden($data);
-
+ $data = array(
+ 'name'  => 'John Doe',
+ 'email' => 'john@example.com',
+ 'url'   => 'http://example.com'
+ );
+
+ echo form_hidden($data);
+
/*
- Would produce:
- <input type="hidden" name="name" value="John Doe" />
- <input type="hidden" name="email" value="john@example.com" />
+ Would produce:
+ <input type="hidden" name="name" value="John Doe" />
+ <input type="hidden" name="email" value="john@example.com" />
<input type="hidden" name="url" value="http://example.com" />
*/
+Or pass an associative array to the value field.
+
+::
+
+ $data = array(
+ 'name'  => 'John Doe',
+ 'email' => 'john@example.com',
+ 'url'   => 'http://example.com'
+ );
+
+ echo form_hidden('my_array', $data);
+
+ /*
+ Would produce:
+ <input type="hidden" name="my_array[name]" value="John Doe" />
+ <input type="hidden" name="my_array[email]" value="john@example.com" />
+ <input type="hidden" name="my_array[url]" value="http://example.com" />
+ */
+
+If you want to create hidden input fields with extra attributes
+
+::
+
+ $data = array(
+ 'type'        => 'hidden',
+ 'name'        => 'email',
+ 'id'          => 'hiddenemail',
+ 'value'       => 'john@example.com',
+ 'class'       => 'hiddenemail'
+ );
+
+ echo form_input($data);
+
+ /*
+ Would produce:
+
+ <input type="hidden" name="email" value="john@example.com" id="hiddenemail" class="hiddenemail" />
+ */
+
form_input()
============
@@ -124,21 +163,21 @@ form to contain
::
- $data = array(               
- 'name'        => 'username',               
- 'id'          => 'username',               
- 'value'       => 'johndoe',               
- 'maxlength'   => '100',               
- 'size'        => '50',               
- 'style'       => 'width:50%',             
- );
-
+ $data = array(
+ 'name'        => 'username',
+ 'id'          => 'username',
+ 'value'       => 'johndoe',
+ 'maxlength'   => '100',
+ 'size'        => '50',
+ 'style'       => 'width:50%'
+ );
+
echo form_input($data);
-
+
/*
Would produce:
-
- <input type="text" name="username" id="username" value="johndoe" maxlength="100" size="50" style="width:50%" />
+
+ <input type="text" name="username" value="johndoe" id="username" maxlength="100" size="50" style="width:50%" />
*/
If you would like your form to contain some additional data, like
@@ -146,7 +185,7 @@ Javascript, you can pass it as a string in the third parameter
::
- $js = 'onClick="some_function()"';
+ $js = 'onClick="some_function()"';
echo form_input('username', 'johndoe', $js);
form_password()
@@ -176,37 +215,37 @@ multiple select for you. Example
::
- $options = array(                   
- 'small'  => 'Small Shirt',                   
- 'med'    => 'Medium Shirt',                   
- 'large'   => 'Large Shirt',                   
- 'xlarge' => 'Extra Large Shirt',                 
- );
-
- $shirts_on_sale = array('small', 'large');
- echo form_dropdown('shirts', $options, 'large');
-
+ $options = array(
+ 'small'  => 'Small Shirt',
+ 'med'    => 'Medium Shirt',
+ 'large'   => 'Large Shirt',
+ 'xlarge' => 'Extra Large Shirt',
+ );
+
+ $shirts_on_sale = array('small', 'large');
+ echo form_dropdown('shirts', $options, 'large');
+
/*
- Would produce:
-
- <select name="shirts">
- <option value="small">Small Shirt</option>
- <option value="med">Medium Shirt</option>
- <option value="large" selected="selected">Large Shirt</option>
- <option value="xlarge">Extra Large Shirt</option>
+ Would produce:
+
+ <select name="shirts">
+ <option value="small">Small Shirt</option>
+ <option value="med">Medium Shirt</option>
+ <option value="large" selected="selected">Large Shirt</option>
+ <option value="xlarge">Extra Large Shirt</option>
</select>
*/
-
+
echo form_dropdown('shirts', $options, $shirts_on_sale);
-
+
/*
- Would produce:
-
- <select name="shirts" multiple="multiple">
- <option value="small" selected="selected">Small Shirt</option>
- <option value="med">Medium Shirt</option>
- <option value="large" selected="selected">Large Shirt</option>
- <option value="xlarge">Extra Large Shirt</option>
+ Would produce:
+
+ <select name="shirts" multiple="multiple">
+ <option value="small" selected="selected">Small Shirt</option>
+ <option value="med">Medium Shirt</option>
+ <option value="large" selected="selected">Large Shirt</option>
+ <option value="xlarge">Extra Large Shirt</option>
</select>
*/
@@ -216,7 +255,7 @@ parameter
::
- $js = 'id="shirts" onChange="some_function();"';
+ $js = 'id="shirts" onChange="some_function();"';
echo form_dropdown('shirts', $options, 'large', $js);
If the array passed as $options is a multidimensional array,
@@ -240,38 +279,38 @@ Lets you generate fieldset/legend fields.
::
- echo form_fieldset('Address Information');
- echo "<p>fieldset content here</p>\n";
+ echo form_fieldset('Address Information');
+ echo "<p>fieldset content here</p>\n";
echo form_fieldset_close();
-
+
/*
Produces:
- <fieldset>
- <legend>Address Information</legend>
- <p>form content here</p>
+ <fieldset>
+ <legend>Address Information</legend>
+ <p>form content here</p>
</fieldset>
*/
-
+
Similar to other functions, you can submit an associative array in the
second parameter if you prefer to set additional attributes.
::
$attributes = array(
- 'id' => 'address_info',
+ 'id' => 'address_info',
'class' => 'address_info'
- );
-
- echo form_fieldset('Address Information', $attributes);
- echo "<p>fieldset content here</p>\n";
- echo form_fieldset_close();
-
+ );
+
+ echo form_fieldset('Address Information', $attributes);
+ echo "<p>fieldset content here</p>\n";
+ echo form_fieldset_close();
+
/*
- Produces:
-
- <fieldset id="address_info" class="address_info">
- <legend>Address Information</legend>
- <p>form content here</p>
+ Produces:
+
+ <fieldset id="address_info" class="address_info">
+ <legend>Address Information</legend>
+ <p>form content here</p>
</fieldset>
*/
@@ -284,9 +323,9 @@ the tag. For example
::
- $string = "</div></div>";
- echo form_fieldset_close($string);
- // Would produce: </fieldset> </div></div>
+ $string = "</div></div>";
+ echo form_fieldset_close($string);
+ // Would produce: </fieldset></div></div>
form_checkbox()
===============
@@ -295,7 +334,7 @@ Lets you generate a checkbox field. Simple example
::
- echo form_checkbox('newsletter', 'accept', TRUE);
+ echo form_checkbox('newsletter', 'accept', TRUE);
// Would produce: <input type="checkbox" name="newsletter" value="accept" checked="checked" />
The third parameter contains a boolean TRUE/FALSE to determine whether
@@ -306,15 +345,15 @@ array of attributes to the function
::
- $data = array(     
- 'name'        => 'newsletter',     
- 'id'          => 'newsletter',     
- 'value'       => 'accept',     
- 'checked'     => TRUE,     
- 'style'       => 'margin:10px',     
- );
-
- echo form_checkbox($data);
+ $data = array(
+ 'name'        => 'newsletter',
+ 'id'          => 'newsletter',
+ 'value'       => 'accept',
+ 'checked'     => TRUE,
+ 'style'       => 'margin:10px',
+ );
+
+ echo form_checkbox($data);
// Would produce: <input type="checkbox" name="newsletter" id="newsletter" value="accept" checked="checked" style="margin:10px" />
As with other functions, if you would like the tag to contain additional
@@ -323,7 +362,7 @@ parameter
::
- $js = 'onClick="some_function()"';
+ $js = 'onClick="some_function()"';
echo form_checkbox('newsletter', 'accept', TRUE, $js)
form_radio()
@@ -339,7 +378,7 @@ Lets you generate a standard submit button. Simple example
::
- echo form_submit('mysubmit', 'Submit Post!');
+ echo form_submit('mysubmit', 'Submit Post!');
// Would produce: <input type="submit" name="mysubmit" value="Submit Post!" />
Similar to other functions, you can submit an associative array in the
@@ -353,7 +392,7 @@ Lets you generate a <label>. Simple example
::
- echo form_label('What is your Name', 'username');
+ echo form_label('What is your Name', 'username');
// Would produce: <label for="username">What is your Name</label>
Similar to other functions, you can submit an associative array in the
@@ -361,12 +400,12 @@ third parameter if you prefer to set additional attributes.
::
- $attributes = array(     
- 'class' => 'mycustomclass',     
+ $attributes = array(
+ 'class' => 'mycustomclass',
'style' => 'color: #000;'
- );
-
- echo form_label('What is your Name', 'username', $attributes);
+ );
+
+ echo form_label('What is your Name', 'username', $attributes);
// Would produce: <label for="username" class="mycustomclass" style="color: #000;">What is your Name</label>
@@ -384,7 +423,7 @@ button name and content in the first and second parameter
::
- echo form_button('name','content');
+ echo form_button('name','content');
// Would produce <button name="name" type="button">Content</button>
Or you can pass an associative array containing any data you wish your
@@ -392,15 +431,15 @@ form to contain:
::
- $data = array(     
- 'name' => 'button',     
- 'id' => 'button',     
- 'value' => 'true',     
- 'type' => 'reset',     
- 'content' => 'Reset'
- );
-
- echo form_button($data);
+ $data = array(
+ 'name' => 'button',
+ 'id' => 'button',
+ 'value' => 'true',
+ 'type' => 'reset',
+ 'content' => 'Reset'
+ );
+
+ echo form_button($data);
// Would produce: <button name="button" id="button" value="true" type="reset">Reset</button>
If you would like your form to contain some additional data, like
@@ -408,7 +447,7 @@ JavaScript, you can pass it as a string in the third parameter:
::
- $js = 'onClick="some_function()"';
+ $js = 'onClick="some_function()"';
echo form_button('mybutton', 'Click Me', $js);
form_close()
@@ -420,8 +459,8 @@ the tag. For example
::
- $string = "</div></div>";
- echo form_close($string);
+ $string = "</div></div>";
+ echo form_close($string);
// Would produce: </form> </div></div>
form_prep()
@@ -432,7 +471,7 @@ elements without breaking out of the form. Consider this example
::
- $string = 'Here is a string containing "quoted" text.';
+ $string = 'Here is a string containing "quoted" text.';
<input type="text" name="myform" value="$string" />
Since the above string contains a set of quotes it will cause the form
@@ -475,9 +514,9 @@ Example
::
<select name="myselect">
- <option value="one" <?php echo set_select('myselect', 'one', TRUE); ?> >One</option>
- <option value="two" <?php echo set_select('myselect', 'two'); ?> >Two</option>
- <option value="three" <?php echo set_select('myselect', 'three'); ?> >Three</option>
+ <option value="one" <?php echo set_select('myselect', 'one', TRUE); ?> >One</option>
+ <option value="two" <?php echo set_select('myselect', 'two'); ?> >Two</option>
+ <option value="three" <?php echo set_select('myselect', 'three'); ?> >Three</option>
</select>
set_checkbox()
@@ -490,7 +529,7 @@ lets you set an item as the default (use boolean TRUE/FALSE). Example
::
- <input type="checkbox" name="mycheck" value="1" <?php echo set_checkbox('mycheck', '1'); ?> />
+ <input type="checkbox" name="mycheck" value="1" <?php echo set_checkbox('mycheck', '1'); ?> />
<input type="checkbox" name="mycheck" value="2" <?php echo set_checkbox('mycheck', '2'); ?> />
set_radio()
@@ -501,6 +540,6 @@ This function is identical to the **set_checkbox()** function above.
::
- <input type="radio" name="myradio" value="1" <?php echo set_radio('myradio', '1', TRUE); ?> />
+ <input type="radio" name="myradio" value="1" <?php echo set_radio('myradio', '1', TRUE); ?> />
<input type="radio" name="myradio" value="2" <?php echo set_radio('myradio', '2'); ?> />
diff --git a/user_guide_src/source/helpers/html_helper.rst b/user_guide_src/source/helpers/html_helper.rst
index 2e217898e..17c28cd2a 100644
--- a/user_guide_src/source/helpers/html_helper.rst
+++ b/user_guide_src/source/helpers/html_helper.rst
@@ -325,24 +325,44 @@ Strict is used by default, but many doctypes are available.
The following is a list of doctype choices. These are configurable, and
pulled from application/config/doctypes.php
-+------------------------+--------------------------+---------------------------------------------------------------------------------------------------------------------------+
-| Doctype | Option | Result |
-+========================+==========================+===========================================================================================================================+
-| XHTML 1.1 | doctype('xhtml11') | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> |
-+------------------------+--------------------------+---------------------------------------------------------------------------------------------------------------------------+
-| XHTML 1.0 Strict | doctype('xhtml1-strict') | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> |
-+------------------------+--------------------------+---------------------------------------------------------------------------------------------------------------------------+
-| XHTML 1.0 Transitional | doctype('xhtml1-trans') | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
-+------------------------+--------------------------+---------------------------------------------------------------------------------------------------------------------------+
-| XHTML 1.0 Frameset | doctype('xhtml1-frame') | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd"> |
-+------------------------+--------------------------+---------------------------------------------------------------------------------------------------------------------------+
-| XHTML Basic 1.1 | doctype('xhtml-basic11') | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML Basic 1.1//EN" "http://www.w3.org/TR/xhtml-basic/xhtml-basic11.dtd"> |
-+------------------------+--------------------------+---------------------------------------------------------------------------------------------------------------------------+
-| HTML 5 | doctype('html5') | <!DOCTYPE html> |
-+------------------------+--------------------------+---------------------------------------------------------------------------------------------------------------------------+
-| HTML 4 Strict | doctype('html4-strict') | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> |
-+------------------------+--------------------------+---------------------------------------------------------------------------------------------------------------------------+
-| HTML 4 Transitional | doctype('html4-trans') | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> |
-+------------------------+--------------------------+---------------------------------------------------------------------------------------------------------------------------+
-| HTML 4 Frameset | doctype('html4-frame') | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd"> |
-+------------------------+--------------------------+---------------------------------------------------------------------------------------------------------------------------+
++-------------------------------+------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------+
+| Doctype | Option | Result |
++===============================+==============================+==================================================================================================================================================+
+| XHTML 1.1 | doctype('xhtml11') | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> |
++-------------------------------+------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------+
+| XHTML 1.0 Strict | doctype('xhtml1-strict') | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> |
++-------------------------------+------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------+
+| XHTML 1.0 Transitional | doctype('xhtml1-trans') | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
++-------------------------------+------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------+
+| XHTML 1.0 Frameset | doctype('xhtml1-frame') | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd"> |
++-------------------------------+------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------+
+| XHTML Basic 1.1 | doctype('xhtml-basic11') | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML Basic 1.1//EN" "http://www.w3.org/TR/xhtml-basic/xhtml-basic11.dtd"> |
++-------------------------------+------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------+
+| HTML 5 | doctype('html5') | <!DOCTYPE html> |
++-------------------------------+------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------+
+| HTML 4 Strict | doctype('html4-strict') | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> |
++-------------------------------+------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------+
+| HTML 4 Transitional | doctype('html4-trans') | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> |
++-------------------------------+------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------+
+| HTML 4 Frameset | doctype('html4-frame') | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd"> |
++-------------------------------+------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------+
+| MathML 1.01 | doctype('mathml1') | <!DOCTYPE math SYSTEM "http://www.w3.org/Math/DTD/mathml1/mathml.dtd"> |
++-------------------------------+------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------+
+| MathML 2.0 | doctype('mathml2') | <!DOCTYPE math PUBLIC "-//W3C//DTD MathML 2.0//EN" "http://www.w3.org/Math/DTD/mathml2/mathml2.dtd"> |
++-------------------------------+------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------+
+| SVG 1.0 | doctype('svg10') | <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd"> |
++-------------------------------+------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------+
+| SVG 1.1 Full | doctype('svg11') | <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> |
++-------------------------------+------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------+
+| SVG 1.1 Basic | doctype('svg11-basic') | <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Basic//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-basic.dtd"> |
++-------------------------------+------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------+
+| SVG 1.1 Tiny | doctype('svg11-tiny') | <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd"> |
++-------------------------------+------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------+
+| XHTML+MathML+SVG (XHTML host) | doctype('xhtml-math-svg-xh') | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN" "http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd"> |
++-------------------------------+------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------+
+| XHTML+MathML+SVG (SVG host) | doctype('xhtml-math-svg-sh') | <!DOCTYPE svg:svg PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN" "http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd"> |
++-------------------------------+------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------+
+| XHTML+RDFa 1.0 | doctype('xhtml-rdfa-1') | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.0//EN" "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd"> |
++-------------------------------+------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------+
+| XHTML+RDFa 1.1 | doctype('xhtml-rdfa-2') | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.1//EN" "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-2.dtd"> |
++-------------------------------+------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------+ \ No newline at end of file
diff --git a/user_guide_src/source/helpers/path_helper.rst b/user_guide_src/source/helpers/path_helper.rst
index 1a70af458..847f5a08b 100644
--- a/user_guide_src/source/helpers/path_helper.rst
+++ b/user_guide_src/source/helpers/path_helper.rst
@@ -28,10 +28,16 @@ cannot be resolved.
::
- $directory = '/etc/passwd';
- echo set_realpath($directory); // returns "/etc/passwd"
- $non_existent_directory = '/path/to/nowhere';
- echo set_realpath($non_existent_directory, TRUE); // returns an error, as the path could not be resolved
- echo set_realpath($non_existent_directory, FALSE); // returns "/path/to/nowhere"
-
-
+ $file = '/etc/php5/apache2/php.ini';
+ echo set_realpath($file); // returns "/etc/php5/apache2/php.ini"
+
+ $non_existent_file = '/path/to/non-exist-file.txt';
+ echo set_realpath($non_existent_file, TRUE); // shows an error, as the path cannot be resolved
+ echo set_realpath($non_existent_file, FALSE); // returns "/path/to/non-exist-file.txt"
+
+ $directory = '/etc/php5';
+ echo set_realpath($directory); // returns "/etc/php5/"
+
+ $non_existent_directory = '/path/to/nowhere';
+ echo set_realpath($non_existent_directory, TRUE); // shows an error, as the path cannot be resolved
+ echo set_realpath($non_existent_directory, FALSE); // returns "/path/to/nowhere"
diff --git a/user_guide_src/source/helpers/security_helper.rst b/user_guide_src/source/helpers/security_helper.rst
index 01018c61a..b1bcf2b4a 100644
--- a/user_guide_src/source/helpers/security_helper.rst
+++ b/user_guide_src/source/helpers/security_helper.rst
@@ -34,8 +34,9 @@ More info can be found there.
do_hash()
=========
-Permits you to create SHA1 or MD5 one way hashes suitable for encrypting
-passwords. Will create SHA1 by default. Examples
+Permits you to create one way hashes suitable for encrypting
+passwords. Will create SHA1 by default. See `hash_algos() <http://php.net/function.hash_algos>`_
+for a full list of supported algorithms.
::
@@ -43,7 +44,7 @@ passwords. Will create SHA1 by default. Examples
$str = do_hash($str, 'md5'); // MD5
.. note:: This function was formerly named dohash(), which has been
- deprecated in favor of `do_hash()`.
+ removed in favor of `do_hash()`.
strip_image_tags()
==================
diff --git a/user_guide_src/source/helpers/string_helper.rst b/user_guide_src/source/helpers/string_helper.rst
index dc70e461a..2d23fb00c 100644
--- a/user_guide_src/source/helpers/string_helper.rst
+++ b/user_guide_src/source/helpers/string_helper.rst
@@ -108,6 +108,36 @@ found in http://. Example
$string = "http://example.com//index.php";
echo reduce_double_slashes($string); // results in "http://example.com/index.php"
+strip_slashes()
+===============
+
+Removes any slashes from a string. Example
+
+::
+
+ $str = "Is your name O\'reilly?";
+ echo strip_slashes($str); // results in Is your name O'reilly?
+
+You can also use an array. Example
+
+::
+
+ $str = array(
+ 'question'  => 'Is your name O\'reilly?',
+ 'answer' => 'No, my name is O\'connor.'
+ );
+
+ $str = strip_slashes($str);
+
+The above will return the following array:
+
+::
+
+ array(
+ 'question'  => "Is your name O'reilly?",
+ 'answer' => "No, my name is O'connor."
+ );
+
trim_slashes()
==============
diff --git a/user_guide_src/source/installation/upgrade_200.rst b/user_guide_src/source/installation/upgrade_200.rst
index 0bcbd5c99..29f44bd9e 100644
--- a/user_guide_src/source/installation/upgrade_200.rst
+++ b/user_guide_src/source/installation/upgrade_200.rst
@@ -87,7 +87,14 @@ All native CodeIgniter classes now use the PHP 5 \__construct()
convention. Please update extended libraries to call
parent::\__construct().
-Step 8: Update your user guide
+Step 8: Move any core extensions to application/core
+====================================================
+
+Any extensions to core classes (e.g. MY_Controller.php) in your
+application/libraries folder must be moved to the new
+application/core folder.
+
+Step 9: Update your user guide
==============================
Please replace your local copy of the user guide with the new version,
@@ -102,7 +109,7 @@ Please refer to the :ref:`2.0.0 Change Log <2.0.0-changelog>` for full
details, but here are some of the larger changes that are more likely to
impact your code:
-- CodeIgniter now requires PHP 5.1.6.
+- CodeIgniter now requires PHP 5.2.4.
- Scaffolding has been removed.
- The CAPTCHA plugin in now a :doc:`helper </helpers/captcha_helper>`.
- The JavaScript calendar plugin was removed.
diff --git a/user_guide_src/source/installation/upgrade_300.rst b/user_guide_src/source/installation/upgrade_300.rst
index 4c594ab17..63c4227dc 100644
--- a/user_guide_src/source/installation/upgrade_300.rst
+++ b/user_guide_src/source/installation/upgrade_300.rst
@@ -31,3 +31,18 @@ Step 3: Remove $autoload['core'] from your config/autoload.php
Use of the `$autoload['core']` config array has been deprecated as of CodeIgniter 1.4.1 and is now removed.
Move any entries that you might have listed there to `$autoload['libraries']` instead.
+
+Step 4: Update your config/database.php
+=======================================
+
+Due to 3.0.0's renaming of Active Record to Query Builder, inside your _config/database.php_, you will
+need to rename the `$active_record` variable to `$query_builder`.
+
+ $active_group = 'default';
+ // $active_record = TRUE;
+ $query_builder = TRUE;
+
+Step 5: Move your errors folder
+===============================
+
+In version 3.0.0, the errors folder has been moved from "application/errors" to "application/views/errors". \ No newline at end of file
diff --git a/user_guide_src/source/libraries/config.rst b/user_guide_src/source/libraries/config.rst
index c81cad7b3..08d9c2905 100644
--- a/user_guide_src/source/libraries/config.rst
+++ b/user_guide_src/source/libraries/config.rst
@@ -149,11 +149,13 @@ folders:
- Your own custom configuration files
.. note::
- CodeIgniter always tries to load the configuration files for
- the current environment first. If the file does not exist, the global
- config file (i.e., the one in application/config/) is loaded. This means
- you are not obligated to place **all** of your configuration files in an
- environment folder − only the files that change per environment.
+ CodeIgniter always loads the global config file first (i.e., the one in application/config/),
+ then tries to load the configuration files for the current environment.
+ This means you are not obligated to place **all** of your configuration files in an
+ environment folder. Only the files that change per environment. Additionally you don't
+ have to copy **all** the config items in the environment config file. Only the config items
+ that you wish to change for your environment. The config items declared in your environment
+ folders always overwrite those in your global config files.
Helper Functions
================
diff --git a/user_guide_src/source/libraries/email.rst b/user_guide_src/source/libraries/email.rst
index 27b704dae..f99eb91df 100644
--- a/user_guide_src/source/libraries/email.rst
+++ b/user_guide_src/source/libraries/email.rst
@@ -104,6 +104,7 @@ Preference Default Value Options Descript
**newline** \\n "\\r\\n" or "\\n" or "\\r" Newline character. (Use "\\r\\n" to comply with RFC 822).
**bcc_batch_mode** FALSE TRUE or FALSE (boolean) Enable BCC Batch Mode.
**bcc_batch_size** 200 None Number of emails in each BCC batch.
+**dsn** FALSE TRUE or FALSE (boolean) Enable notify message from server
=================== ====================== ============================ =======================================================================
Email Function Reference
@@ -181,6 +182,14 @@ formatting which is added to the header string for people who do not
accept HTML email. If you do not set your own message CodeIgniter will
extract the message from your HTML email and strip the tags.
+$this->email->set_header()
+-----------------------
+
+Appends additional headers to the e-mail::
+
+ $this->email->set_header('Header1', 'Value1');
+ $this->email->set_header('Header2', 'Value2');
+
$this->email->clear()
---------------------
@@ -228,11 +237,20 @@ use the function multiple times. For example::
$this->email->attach('/path/to/photo2.jpg');
$this->email->attach('/path/to/photo3.jpg');
-If you'd like to change the disposition or add a custom file name, you can use the second and third paramaters. To use the default disposition (attachment), leave the second parameter blank. Here's an example::
-
- $this->email->attach('/path/to/photo1.jpg', 'inline');
- $this->email->attach('/path/to/photo1.jpg', '', 'birthday.jpg');
-
+To use the default disposition (attachment), leave the second parameter blank,
+otherwise use a custom disposition::
+
+ $this->email->attach('image.jpg', 'inline');
+
+If you'd like to use a custom file name, you can use the third paramater::
+
+ $this->email->attach('filename.pdf', 'attachment', 'report.pdf');
+
+If you need to use a buffer string instead of a real - physical - file you can
+use the first parameter as buffer, the third parameter as file name and the fourth
+parameter as mime-type::
+
+ $this->email->attach($buffer, 'attachment', 'report.pdf', 'application/pdf');
$this->email->print_debugger()
-------------------------------
diff --git a/user_guide_src/source/libraries/file_uploading.rst b/user_guide_src/source/libraries/file_uploading.rst
index 90efca95d..d573fc770 100644
--- a/user_guide_src/source/libraries/file_uploading.rst
+++ b/user_guide_src/source/libraries/file_uploading.rst
@@ -90,24 +90,24 @@ this code and save it to your applications/controllers/ folder::
class Upload extends CI_Controller {
- function __construct()
+ public function __construct()
{
parent::__construct();
$this->load->helper(array('form', 'url'));
}
- function index()
+ public function index()
{
$this->load->view('upload_form', array('error' => ' ' ));
}
- function do_upload()
+ public function do_upload()
{
- $config['upload_path'] = './uploads/';
- $config['allowed_types'] = 'gif|jpg|png';
- $config['max_size'] = '100';
- $config['max_width'] = '1024';
- $config['max_height'] = '768';
+ $config['upload_path'] = './uploads/';
+ $config['allowed_types'] = 'gif|jpg|png';
+ $config['max_size'] = 100;
+ $config['max_width'] = 1024;
+ $config['max_height'] = 768;
$this->load->library('upload', $config);
diff --git a/user_guide_src/source/libraries/form_validation.rst b/user_guide_src/source/libraries/form_validation.rst
index e7875bc22..028b61c4c 100644
--- a/user_guide_src/source/libraries/form_validation.rst
+++ b/user_guide_src/source/libraries/form_validation.rst
@@ -123,7 +123,7 @@ this code and save it to your applications/controllers/ folder::
class Form extends CI_Controller {
- function index()
+ public function index()
{
$this->load->helper(array('form', 'url'));
@@ -219,7 +219,7 @@ Your controller should now look like this::
class Form extends CI_Controller {
- function index()
+ public function index()
{
$this->load->helper(array('form', 'url'));
@@ -321,7 +321,7 @@ password to MD5, and running the username through the "xss_clean"
function, which removes malicious data.
**Any native PHP function that accepts one parameter can be used as a
-rule, like htmlspecialchars, trim, MD5, etc.**
+rule, like htmlspecialchars, trim, md5, etc.**
.. note:: You will generally want to use the prepping functions
**after** the validation rules so if there is an error, the original
@@ -523,7 +523,7 @@ Changing the Error Delimiters
By default, the Form Validation class adds a paragraph tag (<p>) around
each error message shown. You can either change these delimiters
-globally or individually.
+globally, individually, or change the defaults in a config file.
#. **Changing delimiters Globally**
To globally change the error delimiters, in your controller function,
@@ -543,6 +543,12 @@ globally or individually.
<?php echo validation_errors('<div class="error">', '</div>'); ?>
+#. **Set delimiters in a config file**
+ You can add your error delimiters in application/config/form_validation.php as follows::
+
+ $config['error_prefix'] = '<div class="error_prefix">';
+ $config['error_suffix'] = '</div>';
+
Showing Errors Individually
===========================
@@ -579,6 +585,29 @@ must supply it as an array to the function. Example::
For more info please see the :ref:`using-arrays-as-field-names` section below.
+Validating an Array (other than $_POST)
+=======================================
+
+Sometimes you may want to validate an array that does not originate from $_POST data.
+
+In this case, you can specify the array to be validated::
+
+ $data = array(
+ 'username' => 'johndoe',
+ 'password' => 'mypassword',
+ 'passconf' => 'mypassword'
+ );
+
+ $this->form_validation->set_data($data);
+
+Creating validation rules, running the validation and retrieving error messages works the same whether you are
+validating $_POST data or an array.
+
+**Important Note:** If you want to validate more than one array during a single execution, then you should
+call the reset_validation() function before setting up rules and validating the new array.
+
+For more info please see the :ref:`function-reference` section below.
+
.. _saving-groups:
************************************************
@@ -823,42 +852,49 @@ Rule Reference
The following is a list of all the native rules that are available to
use:
-======================= ========== ============================================================================================= =======================
-Rule Parameter Description Example
-======================= ========== ============================================================================================= =======================
-**required** No Returns FALSE if the form element is empty.
-**matches** Yes Returns FALSE if the form element does not match the one in the parameter. matches[form_item]
-**is_unique** Yes Returns FALSE if the form element is not unique to the is_unique[table.field]
- table and field name in the parameter. is_unique[table.field]
-**max_length** Yes Returns FALSE if the form element is longer then the parameter value. max_length[12]
-**exact_length** Yes Returns FALSE if the form element is not exactly the parameter value. exact_length[8]
-**greater_than** Yes Returns FALSE if the form element is less than the parameter value or not numeric. greater_than[8]
-**less_than** Yes Returns FALSE if the form element is greater than the parameter value or not numeric. less_than[8]
-**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_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.
-**integer** No Returns FALSE if the form element contains anything other than an integer.
-**decimal** Yes Returns FALSE if the form element is not exactly the parameter value.
-**is_natural** No Returns FALSE if the form element contains anything other than a natural number:
- 0, 1, 2, 3, etc.
-**is_natural_no_zero** No Returns FALSE if the form element contains anything other than a natural
- number, but not zero: 1, 2, 3, etc.
-**is_unique** Yes Returns FALSE if the form element is not unique in a database table. is_unique[table.field]
-**valid_email** No Returns FALSE if the form element does not contain a valid email address.
-**valid_emails** No Returns FALSE if any value provided in a comma separated list is not a valid email.
-**valid_ip** No Returns FALSE if the supplied IP is not valid.
-**valid_base64** No Returns FALSE if the supplied string contains anything other than valid Base64 characters.
-======================= ========== ============================================================================================= =======================
+========================= ========== ============================================================================================= =======================
+Rule Parameter Description Example
+========================= ========== ============================================================================================= =======================
+**required** No Returns FALSE if the form element is empty.
+**matches** Yes Returns FALSE if the form element does not match the one in the parameter. matches[form_item]
+**is_unique** Yes Returns FALSE if the form element is not unique to the is_unique[table.field]
+ table and field name in the parameter. is_unique[table.field]
+**max_length** Yes Returns FALSE if the form element is longer then the parameter value. max_length[12]
+**exact_length** Yes Returns FALSE if the form element is not exactly the parameter value. exact_length[8]
+**greater_than** Yes Returns FALSE if the form element is less than or equal to the parameter value or not greater_than[8]
+ numeric.
+**greater_than_equal_to** Yes Returns FALSE if the form element is less than the parameter value, greater_than_equal_to[8]
+ or not numeric.
+**less_than** Yes Returns FALSE if the form element is greater than or equal to the parameter value or less_than[8]
+ not numeric.
+**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_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.
+**integer** No Returns FALSE if the form element contains anything other than an integer.
+**decimal** No Returns FALSE if the form element contains anything other than a decimal number.
+**is_natural** No Returns FALSE if the form element contains anything other than a natural number:
+ 0, 1, 2, 3, etc.
+**is_natural_no_zero** No Returns FALSE if the form element contains anything other than a natural
+ number, but not zero: 1, 2, 3, etc.
+**is_unique** Yes Returns FALSE if the form element is not unique in a database table. is_unique[table.field]
+**valid_email** No Returns FALSE if the form element does not contain a valid email address.
+**valid_emails** No Returns FALSE if any value provided in a comma separated list is not a valid email.
+**valid_ip** No Returns FALSE if the supplied IP is not valid.
+**valid_base64** No Returns FALSE if the supplied string contains anything other than valid Base64 characters.
+========================= ========== ============================================================================================= =======================
.. note:: These rules can also be called as discrete functions. For
example::
$this->form_validation->required($string);
-.. note:: You can also use any native PHP functions that permit one
- parameter.
+.. note:: You can also use any native PHP functions that permit up
+ to two parameters, where at least one is required (to pass
+ the field data).
******************
Prepping Reference
@@ -930,6 +966,33 @@ $this->form_validation->set_message();
Permits you to set custom error messages. See :ref:`setting-error-messages`
+$this->form_validation->set_data();
+========================================
+
+ .. php:method:: set_data ($data = '')
+
+ :param array $data: The data to validate
+
+ Permits you to set an array for validation, instead of using the default
+ $_POST array.
+
+$this->form_validation->reset_validation();
+===========================================
+
+ .. php:method:: reset_validation ()
+
+ Permits you to reset the validation when you validate more than one array.
+ This function should be called before validating each new array.
+
+$this->form_validation->error_array();
+========================================
+
+ .. php:method:: error_array ()
+
+ :rtype: Array
+
+ Returns the error messages as an array.
+
.. _helper-functions:
****************
@@ -1011,4 +1074,3 @@ This function is identical to the **set_checkbox()** function above.
<input type="radio" name="myradio" value="1" <?php echo set_radio('myradio', '1', TRUE); ?> />
<input type="radio" name="myradio" value="2" <?php echo set_radio('myradio', '2'); ?> />
-
diff --git a/user_guide_src/source/libraries/input.rst b/user_guide_src/source/libraries/input.rst
index bcf117358..432bac3c7 100644
--- a/user_guide_src/source/libraries/input.rst
+++ b/user_guide_src/source/libraries/input.rst
@@ -18,7 +18,7 @@ The security filtering function is called automatically when a new
:doc:`controller <../general/controllers>` is invoked. It does the
following:
-- If $config['allow_get_array'] is FALSE(default is TRUE), destroys
+- If $config['allow_get_array'] is FALSE (default is TRUE), destroys
the global GET array.
- Destroys all global variables in the event register_globals is
turned on.
@@ -53,14 +53,7 @@ false (boolean) if not. This lets you conveniently use data without
having to test whether an item exists first. In other words, normally
you might do something like this::
- if ( ! isset($_POST['something']))
- {
- $something = FALSE;
- }
- else
- {
- $something = $_POST['something'];
- }
+ $something = isset($_POST['something']) ? $_POST['something'] : NULL;
With CodeIgniter's built in functions you can simply do this::
@@ -95,11 +88,11 @@ To return an array of all POST items call without any parameters.
To return all POST items and pass them through the XSS filter set the
first parameter NULL while setting the second parameter to boolean;
-The function returns FALSE (boolean) if there are no items in the POST.
+The function returns NULL if there are no items in the POST.
::
- $this->input->post(NULL, TRUE); // returns all POST items with XSS filter
+ $this->input->post(NULL, TRUE); // returns all POST items with XSS filter
$this->input->post(); // returns all POST items without XSS filter
$this->input->get()
@@ -115,13 +108,13 @@ To return an array of all GET items call without any parameters.
To return all GET items and pass them through the XSS filter set the
first parameter NULL while setting the second parameter to boolean;
-The function returns FALSE (boolean) if there are no items in the GET.
+The function returns NULL if there are no items in the GET.
::
- $this->input->get(NULL, TRUE); // returns all GET items with XSS filter
+ $this->input->get(NULL, TRUE); // returns all GET items with XSS filter
$this->input->get(); // returns all GET items without XSS filtering
-
+
$this->input->get_post()
=========================
@@ -210,7 +203,7 @@ the cookie you are looking for (including any prefixes)::
cookie('some_cookie');
-The function returns FALSE (boolean) if the item you are attempting to
+The function returns NULL if the item you are attempting to
retrieve does not exist.
The second optional parameter lets you run the data through the XSS
@@ -298,3 +291,13 @@ see if PHP is being run on the command line.
$this->input->is_cli_request()
+$this->input->method();
+=====================================
+
+Returns the $_SERVER['REQUEST_METHOD'], optional set uppercase or lowercase (default lowercase).
+
+::
+
+ echo $this->input->method(TRUE); // Outputs: POST
+ echo $this->input->method(FALSE); // Outputs: post
+ echo $this->input->method(); // Outputs: post
diff --git a/user_guide_src/source/libraries/javascript.rst b/user_guide_src/source/libraries/javascript.rst
index 5e80fb998..d5e09c314 100644
--- a/user_guide_src/source/libraries/javascript.rst
+++ b/user_guide_src/source/libraries/javascript.rst
@@ -86,14 +86,14 @@ The jQuery Class
To initialize the jQuery class manually in your controller constructor,
use the $this->load->library function::
- $this->load->library('jquery');
+ $this->load->library('javascript/jquery');
You may send an optional parameter to determine whether or not a script
tag for the main jQuery file will be automatically included when loading
the library. It will be created by default. To prevent this, load the
library as follows::
- $this->load->library('jquery', FALSE);
+ $this->load->library('javascript/jquery', FALSE);
Once loaded, the jQuery library object will be available using:
$this->jquery
diff --git a/user_guide_src/source/libraries/loader.rst b/user_guide_src/source/libraries/loader.rst
index 2090404bf..aadf9740a 100644
--- a/user_guide_src/source/libraries/loader.rst
+++ b/user_guide_src/source/libraries/loader.rst
@@ -116,12 +116,12 @@ assign it to a variable if you want the data returned::
$string = $this->load->view('myfile', '', true);
-$this->load->model('Model_name');
+$this->load->model('model_name');
==================================
::
- $this->load->model('Model_name');
+ $this->load->model('model_name');
If your model is located in a sub-folder, include the relative path from
@@ -134,7 +134,7 @@ application/models/blog/queries.php you'll load it using::
If you would like your model assigned to a different object name you can
specify it via the second parameter of the loading function::
- $this->load->model('Model_name', 'fubar');
+ $this->load->model('model_name', 'fubar');
$this->fubar->function();
diff --git a/user_guide_src/source/libraries/output.rst b/user_guide_src/source/libraries/output.rst
index 2cf7c0854..baceaae7b 100644
--- a/user_guide_src/source/libraries/output.rst
+++ b/user_guide_src/source/libraries/output.rst
@@ -49,6 +49,15 @@ data, JPEG's, XML, etc easily.
.. important:: Make sure any non-mime string you pass to this method
exists in config/mimes.php or it will have no effect.
+$this->output->get_content_type();
+==========================================
+
+Returns the Content-Type HTTP header that's currently in use.
+
+ $mime = $this->output->get_content_type();
+
+.. note:: If not set, the default return value is 'text/html'.
+
$this->output->get_output();
=============================
diff --git a/user_guide_src/source/libraries/sessions.rst b/user_guide_src/source/libraries/sessions.rst
index ef32f5d71..e8332ee97 100644
--- a/user_guide_src/source/libraries/sessions.rst
+++ b/user_guide_src/source/libraries/sessions.rst
@@ -209,6 +209,10 @@ set_userdata().
To read a flashdata variable::
$this->session->flashdata('item');
+
+An array of all flashdata can be retrieved as follows::
+
+ $this->session->all_flashdata();
If you find that you need to preserve a flashdata variable through an
diff --git a/user_guide_src/source/libraries/table.rst b/user_guide_src/source/libraries/table.rst
index 9bc3f3423..6a808abc2 100644
--- a/user_guide_src/source/libraries/table.rst
+++ b/user_guide_src/source/libraries/table.rst
@@ -116,6 +116,8 @@ example, only the table opening tag is being changed::
$tmpl = array ( 'table_open' => '<table border="1" cellpadding="2" cellspacing="1" class="mytable">' );
$this->table->set_template($tmpl);
+
+You can also set defaults for these in a config file.
******************
Function Reference
diff --git a/user_guide_src/source/libraries/uri.rst b/user_guide_src/source/libraries/uri.rst
index ee60b77d7..cdd76e322 100644
--- a/user_guide_src/source/libraries/uri.rst
+++ b/user_guide_src/source/libraries/uri.rst
@@ -25,7 +25,7 @@ The segment numbers would be this:
#. metro
#. crime_is_up
-By default the function returns FALSE (boolean) if the segment does not
+By default the function returns NULL if the segment does not
exist. There is an optional second parameter that permits you to set
your own default value if the segment is missing. For example, this
would tell the function to return the number zero in the event of
diff --git a/user_guide_src/source/libraries/xmlrpc.rst b/user_guide_src/source/libraries/xmlrpc.rst
index 3b945769f..dfb88114e 100644
--- a/user_guide_src/source/libraries/xmlrpc.rst
+++ b/user_guide_src/source/libraries/xmlrpc.rst
@@ -184,10 +184,10 @@ server will expect a class to exist with this prototype::
class My_blog extends CI_Controller {
- function new_post($request)
- {
+ public function new_post($request)
+ {
- }
+ }
}
The $request variable is an object compiled by the Server, which
@@ -304,7 +304,7 @@ folder::
class Xmlrpc_client extends CI_Controller {
- function index()
+ public function index()
{
$this->load->helper('url');
$server_url = site_url('xmlrpc_server');
@@ -345,7 +345,7 @@ folder::
class Xmlrpc_server extends CI_Controller {
- function index()
+ public function index()
{
$this->load->library('xmlrpc');
$this->load->library('xmlrpcs');
@@ -357,15 +357,17 @@ folder::
}
- function process($request)
+ public function process($request)
{
$parameters = $request->output_parameters();
$response = array(
- array(
- 'you_said' => $parameters['0'],
- 'i_respond' => 'Not bad at all.'),
- 'struct');
+ array(
+ 'you_said' => $parameters[0],
+ 'i_respond' => 'Not bad at all.'
+ ),
+ 'struct'
+ );
return $this->xmlrpc->send_response($response);
}
@@ -419,9 +421,9 @@ the Server.
::
$parameters = $request->output_parameters();
- $name = $parameters['0']['name'];
- $size = $parameters['1']['size'];
- $size = $parameters['1']['shape'];
+ $name = $parameters[0]['name'];
+ $size = $parameters[1]['size'];
+ $size = $parameters[1]['shape'];
**************************
XML-RPC Function Reference
diff --git a/user_guide_src/source/overview/at_a_glance.rst b/user_guide_src/source/overview/at_a_glance.rst
index 31f0b4dd9..6dcfdbb14 100644
--- a/user_guide_src/source/overview/at_a_glance.rst
+++ b/user_guide_src/source/overview/at_a_glance.rst
@@ -41,7 +41,7 @@ CodeIgniter Uses M-V-C
CodeIgniter uses the Model-View-Controller approach, which allows great
separation between logic and presentation. This is particularly good for
projects in which designers are working with your template files, as the
-code these file contain will be minimized. We describe MVC in more
+code these files contain will be minimized. We describe MVC in more
detail on its own page.
CodeIgniter Generates Clean URLs
diff --git a/user_guide_src/source/overview/features.rst b/user_guide_src/source/overview/features.rst
index 44db08a94..8c27b1436 100644
--- a/user_guide_src/source/overview/features.rst
+++ b/user_guide_src/source/overview/features.rst
@@ -15,7 +15,7 @@ CodeIgniter's main features.
- Model-View-Controller Based System
- Extremely Light Weight
- Full Featured database classes with support for several platforms.
-- Active Record Database Support
+- Query Builder Database Support
- Form and Data Validation
- Security and XSS Filtering
- Session Management
diff --git a/user_guide_src/source/tutorial/create_news_items.rst b/user_guide_src/source/tutorial/create_news_items.rst
index 794b67eed..bfaf13537 100644
--- a/user_guide_src/source/tutorial/create_news_items.rst
+++ b/user_guide_src/source/tutorial/create_news_items.rst
@@ -94,7 +94,7 @@ Model
-----
The only thing that remains is writing a method that writes the data to
-the database. You'll use the Active Record class to insert the
+the database. You'll use the Query Builder class to insert the
information and use the input library to get the posted data. Open up
the model created earlier and add the following:
diff --git a/user_guide_src/source/tutorial/index.rst b/user_guide_src/source/tutorial/index.rst
index c959d04d2..b1ab331d1 100644
--- a/user_guide_src/source/tutorial/index.rst
+++ b/user_guide_src/source/tutorial/index.rst
@@ -16,7 +16,7 @@ This tutorial will primarily focus on:
- Model-View-Controller basics
- Routing basics
- Form validation
-- Performing basic database queries using "Active Record"
+- Performing basic database queries using "Query Builder"
The entire tutorial is split up over several pages, each explaining a
small part of the functionality of the CodeIgniter framework. You'll go
diff --git a/user_guide_src/source/tutorial/news_section.rst b/user_guide_src/source/tutorial/news_section.rst
index 38e4214ca..82b3e3b38 100644
--- a/user_guide_src/source/tutorial/news_section.rst
+++ b/user_guide_src/source/tutorial/news_section.rst
@@ -54,7 +54,7 @@ seed records.
Now that the database and a model have been set up, you'll need a method
to get all of our posts from our database. To do this, the database
abstraction layer that is included with CodeIgniter — `Active
-Record <../database/active_record.html>`_ — is used. This makes it
+Record <../database/query_builder.html>`_ — is used. This makes it
possible to write your 'queries' once and make them work on `all
supported database systems <../general/requirements.html>`_. Add the
following code to your model.
@@ -76,7 +76,7 @@ following code to your model.
With this code you can perform two different queries. You can get all
news records, or get a news item by its `slug <#>`_. You might have
noticed that the $slug variable wasn't sanitized before running the
-query; Active Record does this for you.
+query; Query Builder does this for you.
Display the news
----------------
diff --git a/user_guide_src/source/tutorial/static_pages.rst b/user_guide_src/source/tutorial/static_pages.rst
index c7f737951..708eaeb7b 100644
--- a/user_guide_src/source/tutorial/static_pages.rst
+++ b/user_guide_src/source/tutorial/static_pages.rst
@@ -97,7 +97,7 @@ page actually exists:
public function view($page = 'home')
{
- if ( ! file_exists('application/views/pages/'.$page.'.php'))
+ if ( ! file_exists(APPPATH.'/views/pages/'.$page.'.php'))
{
// Whoops, we don't have a page for that!
show_404();