summaryrefslogtreecommitdiffstats
path: root/user_guide_src
diff options
context:
space:
mode:
Diffstat (limited to 'user_guide_src')
-rw-r--r--user_guide_src/cilexer/cilexer/cilexer.py2
-rw-r--r--user_guide_src/source/_themes/eldocs/static/asset/css/common.css2
-rw-r--r--user_guide_src/source/changelog.rst107
-rw-r--r--user_guide_src/source/conf.py4
-rw-r--r--user_guide_src/source/database/active_record.rst193
-rw-r--r--user_guide_src/source/database/configuration.rst43
-rw-r--r--user_guide_src/source/database/connecting.rst23
-rw-r--r--user_guide_src/source/general/urls.rst9
-rw-r--r--user_guide_src/source/helpers/inflector_helper.rst6
-rw-r--r--user_guide_src/source/helpers/string_helper.rst2
-rw-r--r--user_guide_src/source/helpers/text_helper.rst5
-rw-r--r--user_guide_src/source/helpers/url_helper.rst21
-rw-r--r--user_guide_src/source/installation/upgrade_300.rst28
-rw-r--r--user_guide_src/source/libraries/cart.rst20
-rw-r--r--user_guide_src/source/libraries/email.rst6
-rw-r--r--user_guide_src/source/libraries/encryption.rst15
-rw-r--r--user_guide_src/source/libraries/image_lib.rst12
-rw-r--r--user_guide_src/source/libraries/loader.rst6
-rw-r--r--user_guide_src/source/libraries/migration.rst5
-rw-r--r--user_guide_src/source/tutorial/create_news_items.rst2
-rw-r--r--user_guide_src/source/tutorial/news_section.rst2
-rw-r--r--user_guide_src/source/tutorial/static_pages.rst6
22 files changed, 365 insertions, 154 deletions
diff --git a/user_guide_src/cilexer/cilexer/cilexer.py b/user_guide_src/cilexer/cilexer/cilexer.py
index e571ce627..713268e9c 100644
--- a/user_guide_src/cilexer/cilexer/cilexer.py
+++ b/user_guide_src/cilexer/cilexer/cilexer.py
@@ -15,7 +15,7 @@
# through the world wide web, please send an email to
# licensing@ellislab.com so we can send you a copy immediately.
#
-# Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+# Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
# http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
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 45b1fe724..b9e28aec0 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
@@ -16,7 +16,7 @@ If you did not receive a copy of the license and are unable to obtain it
through the world wide web, please send an email to
licensing@ellislab.com so we can send you a copy immediately.
-Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
+Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
*/
diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst
index 3a2990b2c..59d2ea88d 100644
--- a/user_guide_src/source/changelog.rst
+++ b/user_guide_src/source/changelog.rst
@@ -22,16 +22,86 @@ Release Date: Not Released
- 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.
+ - 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 pgp and gpg to mimes.php.
+ - Added support 3gp, 3g2, mp4, wmv, f4v, vlc Video files to mimes.php.
+ - Added support m4a, aac, m4u, xspf, au, ac3, flac, ogg Audio files to mimes.php.
+ - Changed logger to only chmod when file is first created.
+ - Removed previously deprecated SHA1 Library.
+
+- Helpers
+
+ - 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.
+
+- 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.
+
+- 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:
+ - 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:
+ - 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.
+ - Removed SHA1 function in the :doc:`Encryption Library <libraries/encryption>`.
+
+- Core
+
+ - Changed private functions in CI_URI to protected so MY_URI can
+ override them.
+ - 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()
+
+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 (#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 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 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 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.
+
+Version 2.1.0
+=============
+
+Release Date: Not Released
+
+- General Changes
+
- Callback validation rules can now accept parameters like any other
validation rule.
- - Ability to log certain error types, not all under a threshold.
- Added html_escape() to :doc:`Common
functions <general/common_functions>` to escape HTML output
for preventing XSS.
- - 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 pgp,gpg to mimes.php.
- - Added support 3gp, 3g2, mp4, wmv, f4v, vlc Video files to mimes.php.
- - Added support m4a, aac, m4u, xspf, au, ac3, flac, ogg Audio files to mimes.php.
- Helpers
@@ -42,7 +112,6 @@ Release Date: Not Released
function call optional. Fixes (#65)
- url_title() will now trim extra dashes from beginning and end.
- Improved speed of :doc:`String Helper <helpers/string_helper>`'s random_string() method
- - Added XHTML Basic 1.1 doctype to :doc:`HTML Helper <helpers/html_helper>`.
- Database
@@ -57,9 +126,7 @@ Release Date: Not Released
$this->db->like() in the :doc:`Database
Driver <database/active_record>`.
- Added $this->db->insert_batch() support to the OCI8 (Oracle) driver.
- - 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().
+ - Added failover if the main connections in the config should fail
- Libraries
@@ -69,14 +136,12 @@ Release Date: Not Released
- Added support to set an optional parameter in your callback rules
of validation using the :doc:`Form Validation
Library <libraries/form_validation>`.
- - Added a :doc:`Migration Library <libraries/migration>` to assist with applying
+ - Added a :doc:`Migration library <libraries/migration>` to assist with applying
incremental updates to your database schema.
- Driver children can be located in any package path.
- Added max_filename_increment config setting for Upload library.
- - CI_Loader::_ci_autoloader() is now a protected method.
- Added is_unique to the :doc:`Form Validation
library <libraries/form_validation>`.
- - Modified valid_ip() to use PHP's filter_var() when possible (>= PHP 5.2) in the :doc:`Form Validation library <libraries/form_validation>`.
- Added $config['use_page_numbers'] to the :doc:`Pagination library <libraries/pagination>`, which enables real page numbers in the URI.
- Added TLS and SSL Encryption for SMTP.
@@ -86,10 +151,11 @@ 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
-------------------
-- Unlink raised an error if cache file did not exist when you try to delete it.
+
- 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
@@ -100,21 +166,16 @@ Bug fixes for 2.1.0
but the requested method did not.
- Fixed a bug (Reactor #89) where MySQL export would fail if the table
had hyphens or other non alphanumeric/underscore characters.
-- Fixed a bug (#200) where MySQL queries would be malformed after
- calling count_all() then db->get()
-- Fixed bug #105 that stopped query errors from being logged unless database debugging was enabled
-- Fixed a bug (#181) where a mis-spelling was in the form validation
- language file.
+- Fixed a bug (#200) where MySQL queries would be malformed after calling $this->db->count_all() then $this->db->get()
+- Fixed a bug (#105) that stopped query errors from being logged unless database debugging was enabled
- Fixed a bug (#160) - Removed unneeded array copy in the file cache
driver.
- Fixed a bug (#150) - field_data() now correctly returns column
length.
- Fixed a bug (#8) - load_class() now looks for core classes in
APPPATH first, allowing them to be replaced.
-- Fixed a bug (#24) - ODBC database driver called incorrect parent in
- __construct().
-- Fixed a bug (#85) - OCI8 (Oracle) database escape_str() function did
- not escape correct.
+- Fixed a bug (#24) - ODBC database driver called incorrect parent in __construct().
+- Fixed a bug (#85) - OCI8 (Oracle) database escape_str() function did not escape correct.
- Fixed a bug (#344) - Using schema found in :doc:`Saving Session Data to a Database <libraries/sessions>`, system would throw error "user_data does not have a default value" when deleting then creating a session.
- Fixed a bug (#112) - OCI8 (Oracle) driver didn't pass the configured database character set when connecting.
- Fixed a bug (#182) - OCI8 (Oracle) driver used to re-execute the statement whenever num_rows() is called.
@@ -125,6 +186,8 @@ Bug fixes for 2.1.0
- Fixed a bug (#60) - Added _file_mime_type() method to the :doc:`File Uploading Library <libraries/file_uploading>` in order to fix a possible MIME-type injection.
- Fixed a bug (#537) - Support for all wav type in browser.
- Fixed a bug (#576) - Using ini_get() function to detect if apc is enabled or not.
+- Fixed invalid date time format in :doc:`Date helper <helpers/date_helper>` and :doc:`XMLRPC library <libraries/xmlrpc>`.
+- Fixed a bug (#200) - MySQL queries would be malformed after calling count_all() then db->get().
Version 2.0.3
=============
diff --git a/user_guide_src/source/conf.py b/user_guide_src/source/conf.py
index bb10d06e4..593ceaf1c 100644
--- a/user_guide_src/source/conf.py
+++ b/user_guide_src/source/conf.py
@@ -41,7 +41,7 @@ master_doc = 'index'
# General information about the project.
project = u'CodeIgniter'
-copyright = u'2011, EllisLab, Inc.'
+copyright = u'2012, EllisLab, Inc.'
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
@@ -223,7 +223,7 @@ man_pages = [
epub_title = u'CodeIgniter'
epub_author = u'EllisLab, Inc.'
epub_publisher = u'EllisLab, Inc.'
-epub_copyright = u'2011, EllisLab, Inc.'
+epub_copyright = u'2012, EllisLab, Inc.'
# The language of the text. It defaults to the language option
# or en if the language is not set.
diff --git a/user_guide_src/source/database/active_record.rst b/user_guide_src/source/database/active_record.rst
index 5555a30bc..c04e67d2a 100644
--- a/user_guide_src/source/database/active_record.rst
+++ b/user_guide_src/source/database/active_record.rst
@@ -45,7 +45,7 @@ You'll notice that the above function is assigned to a variable named
$query, which can be used to show the results::
$query = $this->db->get('mytable');
-
+
foreach ($query->result() as $row)
{
echo $row->title;
@@ -57,32 +57,32 @@ discussion regarding result generation.
$this->db->get_compiled_select()
================================
-Compiles the selection query just like `$this->db->get()`_ but does not *run*
+Compiles the selection query just like `$this->db->get()`_ but does not *run*
the query. This method simply returns the SQL query as a string.
Example::
$sql = $this->db->get_compiled_select('mytable');
echo $sql;
-
+
// 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 active record 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);
- // Produces string: SELECT * FROM mytable LIMIT 20, 10
+ // Produces string: SELECT * FROM mytable LIMIT 20, 10
// (in MySQL. Other databases have slightly different syntax)
-
+
echo $this->db->select('title, content, date')->get_compiled_select();
// Produces string: SELECT title, content, date FROM mytable
-
-The key thing to notice in the above example is that the second query did not
-utilize `$this->db->from()`_ and did not pass a table name into the first
-parameter. The reason for this outcome is because the query has not been
-executed using `$this->db->get()`_ which resets values or reset directly
-using `$this-db->reset_query()`_.
+
+The key thing to notice in the above example is that the second query did not
+utilize `$this->db->from()`_ and did not pass a table name into the first
+parameter. The reason for this outcome is because the query has not been
+executed using `$this->db->get()`_ which resets values or reset directly
+using `$this->db->reset_query()`_.
$this->db->get_where()
@@ -96,8 +96,7 @@ function::
Please read the about the where function below for more information.
-Note: get_where() was formerly known as getwhere(), which has been
-removed
+.. note:: get_where() was formerly known as getwhere(), which has been removed
$this->db->select()
===================
@@ -117,7 +116,7 @@ with backticks. This is useful if you need a compound select statement.
::
- $this->db->select('(SELECT SUM(payments.amount) FROM payments WHERE payments.invoice_id=4') AS amount_paid', FALSE);
+ $this->db->select('(SELECT SUM(payments.amount) FROM payments WHERE payments.invoice_id=4') AS amount_paid', FALSE);
$query = $this->db->get('mytable');
@@ -131,7 +130,7 @@ include a second parameter to rename the resulting field.
$this->db->select_max('age');
$query = $this->db->get('members'); // Produces: SELECT MAX(age) as age FROM members
-
+
$this->db->select_max('age', 'member_age');
$query = $this->db->get('members'); // Produces: SELECT MAX(age) as member_age FROM members
@@ -196,9 +195,9 @@ Permits you to write the JOIN portion of your query::
$this->db->from('blogs');
$this->db->join('comments', 'comments.id = blogs.id');
$query = $this->db->get();
-
+
// Produces:
- // SELECT * FROM blogs // JOIN comments ON comments.id = blogs.id
+ // SELECT * FROM blogs JOIN comments ON comments.id = blogs.id
Multiple function calls can be made if you need several joins in one
query.
@@ -225,7 +224,7 @@ methods:
::
- $this->db->where('name', $name); // Produces: WHERE name = 'Joe'
+ $this->db->where('name', $name); // Produces: WHERE name = 'Joe'
Notice that the equal sign is added for you.
@@ -237,7 +236,7 @@ methods:
$this->db->where('name', $name);
$this->db->where('title', $title);
$this->db->where('status', $status);
- // WHERE name = 'Joe' AND title = 'boss' AND status = 'active'
+ // WHERE name = 'Joe' AND title = 'boss' AND status = 'active'
#. **Custom key/value method:**
You can include an operator in the first parameter in order to
@@ -246,7 +245,7 @@ methods:
::
$this->db->where('name !=', $name);
- $this->db->where('id <', $id); // Produces: WHERE name != 'Joe' AND id < 45
+ $this->db->where('id <', $id); // Produces: WHERE name != 'Joe' AND id < 45
#. **Associative array method:**
@@ -254,7 +253,7 @@ methods:
$array = array('name' => $name, 'title' => $title, 'status' => $status);
$this->db->where($array);
- // Produces: WHERE name = 'Joe' AND title = 'boss' AND status = 'active'
+ // Produces: WHERE name = 'Joe' AND title = 'boss' AND status = 'active'
You can include your own operators using this method as well:
@@ -355,7 +354,7 @@ searches.
::
- $this->db->like('title', 'match'); // Produces: WHERE title LIKE '%match%'
+ $this->db->like('title', 'match'); // Produces: WHERE title LIKE '%match%'
If you use multiple function calls they will be chained together with
AND between them::
@@ -372,7 +371,7 @@ searches.
$this->db->like('title', 'match', 'before'); // Produces: WHERE title LIKE '%match'
$this->db->like('title', 'match', 'after'); // Produces: WHERE title LIKE 'match%'
- $this->db->like('title', 'match', 'both'); // Produces: WHERE title LIKE '%match%'
+ $this->db->like('title', 'match', 'both'); // Produces: WHERE title LIKE '%match%'
#. **Associative array method:**
@@ -444,7 +443,7 @@ Permits you to write the HAVING portion of your query. There are 2
possible syntaxes, 1 argument or 2::
$this->db->having('user_id = 45'); // Produces: HAVING user_id = 45
- $this->db->having('user_id', 45); // Produces: HAVING user_id = 45
+ $this->db->having('user_id', 45); // Produces: HAVING user_id = 45
You can also pass an array of multiple values as well::
@@ -487,7 +486,7 @@ Or multiple function calls can be made if you need multiple fields.
::
$this->db->order_by("title", "desc");
- $this->db->order_by("name", "asc"); // Produces: ORDER BY title DESC, name ASC
+ $this->db->order_by("name", "asc"); // Produces: ORDER BY title DESC, name ASC
.. note:: order_by() was formerly known as orderby(), which has been
@@ -519,7 +518,7 @@ where(), or_where(), like(), or_like(), etc. Example::
echo $this->db->count_all_results('my_table'); // Produces an integer, like 25
$this->db->like('title', 'match');
$this->db->from('my_table');
- echo $this->db->count_all_results(); // Produces an integer, like 17
+ echo $this->db->count_all_results(); // Produces an integer, like 17
$this->db->count_all()
======================
@@ -530,6 +529,54 @@ Submit the table name in the first parameter. Example::
echo $this->db->count_all('my_table'); // Produces an integer, like 25
**************
+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:
+
+ $this->db->select('*')->from('my_table')
+ ->group_start()
+ ->where('a', 'a')
+ ->or_group_start()
+ ->where('b', 'b')
+ ->where('c', 'c')
+ ->group_end()
+ ->group_end()
+ ->where('d', 'd')
+ ->get();
+
+ // Generates:
+ // SELECT * FROM (`my_table`) WHERE ( `a` = 'a' OR ( `b` = 'b' AND `c` = 'c' ) ) AND `d` = 'd'
+
+.. note:: groups need to be balanced, make sure every group_start() is matched by a group_end().
+
+$this->db->group_start()
+========================
+
+Starts a new group by adding an opening parenthesis to the WHERE clause of the query.
+
+$this->db->or_group_start()
+===========================
+
+Starts a new group by adding an opening parenthesis to the WHERE clause of the query, prefixing it with 'OR'.
+
+$this->db->not_group_start()
+============================
+
+Starts a new group by adding an opening parenthesis to the WHERE clause of the query, prefixing it with 'NOT'.
+
+$this->db->or_not_group_start()
+===============================
+
+Starts a new group by adding an opening parenthesis to the WHERE clause of the query, prefixing it with 'OR NOT'.
+
+$this->db->group_end()
+======================
+
+Ends the current group by adding an closing parenthesis to the WHERE clause of the query.
+
+**************
Inserting Data
**************
@@ -545,7 +592,7 @@ function. Here is an example using an array::
'name' => 'My Name',
'date' => 'My date'
);
-
+
$this->db->insert('mytable', $data);
// Produces: INSERT INTO mytable (title, name, date) VALUES ('My title', 'My name', 'My date')
@@ -561,7 +608,7 @@ Here is an example using an object::
var $date = 'My Date';
}
*/
-
+
$object = new Myclass;
$this->db->insert('mytable', $object);
// Produces: INSERT INTO mytable (title, content, date) VALUES ('My Title', 'My Content', 'My Date')
@@ -573,7 +620,7 @@ object.
$this->db->get_compiled_insert()
================================
-Compiles the insertion query just like `$this->db->insert()`_ but does not
+Compiles the insertion query just like `$this->db->insert()`_ but does not
*run* the query. This method simply returns the SQL query as a string.
Example::
@@ -583,27 +630,27 @@ Example::
'name' => 'My Name',
'date' => 'My date'
);
-
+
$sql = $this->db->set($data)->get_compiled_insert('mytable');
echo $sql;
-
+
// 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 active record 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);
-
+
// Produces string: INSERT INTO mytable (title) VALUES ('My Title')
-
+
echo $this->db->set('content', 'My Content')->get_compiled_insert();
// Produces string: INSERT INTO mytable (title, content) VALUES ('My Title', 'My Content')
-
-The key thing to notice in the above example is that the second query did not
-utlize `$this->db->from()`_ nor did it pass a table name into the first
-parameter. The reason this worked is because the query has not been executed
-using `$this->db->insert()`_ which resets values or reset directly using
+
+The key thing to notice in the above example is that the second query did not
+utlize `$this->db->from()`_ nor did it pass a table name into the first
+parameter. The reason this worked is because the query has not been executed
+using `$this->db->insert()`_ which resets values or reset directly using
`$this->db->reset_query()`_.
$this->db->insert_batch()
@@ -625,7 +672,7 @@ function. Here is an example using an array::
'date' => 'Another date'
)
);
-
+
$this->db->insert_batch('mytable', $data);
// Produces: INSERT INTO mytable (title, name, date) VALUES ('My title', 'My name', 'My date'), ('Another title', 'Another name', 'Another date')
@@ -653,7 +700,7 @@ based on whether you are doing an insert or an update::
$this->db->set('name', $name);
$this->db->set('title', $title);
$this->db->set('status', $status);
- $this->db->insert('mytable');
+ $this->db->insert('mytable');
**set()** will also accept an optional third parameter ($escape), that
will prevent data from being escaped if set to FALSE. To illustrate the
@@ -675,7 +722,7 @@ You can also pass an associative array to this function::
'title' => $title,
'status' => $status
);
-
+
$this->db->set($array);
$this->db->insert('mytable');
@@ -688,7 +735,7 @@ Or an object::
var $date = 'My Date';
}
*/
-
+
$object = new Myclass;
$this->db->set($object);
$this->db->insert('mytable');
@@ -710,7 +757,7 @@ is an example using an array::
'name' => $name,
'date' => $date
);
-
+
$this->db->where('id', $id);
$this->db->update('mytable', $data);
// Produces: // UPDATE mytable // SET title = '{$title}', name = '{$name}', date = '{$date}' // WHERE id = $id
@@ -724,7 +771,7 @@ Or you can supply an object::
var $date = 'My Date';
}
*/
-
+
$object = new Myclass;
$this->db->where('id', $id);
$this->db->update('mytable', $object);
@@ -765,14 +812,14 @@ Here is an example using an array::
)
);
- $this->db->update_batch('mytable', $data, 'title');
+ $this->db->update_batch('mytable', $data, 'title');
- // Produces:
+ // Produces:
// UPDATE `mytable` SET `name` = CASE
// WHEN `title` = 'My title' THEN 'My Name 2'
// WHEN `title` = 'Another title' THEN 'Another Name 2'
// ELSE `name` END,
- // `date` = CASE
+ // `date` = CASE
// WHEN `title` = 'My title' THEN 'My date 2'
// WHEN `title` = 'Another title' THEN 'Another date 2'
// ELSE `date` END
@@ -789,7 +836,7 @@ $this->db->get_compiled_update()
This works exactly the same way as ``$this->db->get_compiled_insert()`` except
that it produces an UPDATE SQL string instead of an INSERT SQL string.
-For more information view documentation for `$this->get_compiled_insert()`_.
+For more information view documentation for `$this->db->get_compiled_insert()`_.
*************
@@ -811,7 +858,7 @@ the data to the second parameter of the function::
$this->db->where('id', $id);
$this->db->delete('mytable');
-
+
// Produces:
// DELETE FROM mytable
// WHERE id = $id
@@ -836,7 +883,7 @@ $this->db->empty_table()
Generates a delete SQL string and runs the
query.::
- $this->db->empty_table('mytable'); // Produces // DELETE FROM mytable
+ $this->db->empty_table('mytable'); // Produces: DELETE FROM mytable
$this->db->truncate()
@@ -847,24 +894,24 @@ Generates a truncate SQL string and runs the query.
::
$this->db->from('mytable');
- $this->db->truncate();
-
- // or
-
+ $this->db->truncate();
+
+ // or
+
$this->db->truncate('mytable');
-
+
// Produce:
- // TRUNCATE mytable
+ // TRUNCATE mytable
.. note:: If the TRUNCATE command isn't available, truncate() will
execute as "DELETE FROM table".
-
+
$this->db->get_compiled_delete()
================================
This works exactly the same way as ``$this->db->get_compiled_insert()`` except
that it produces a DELETE SQL string instead of an INSERT SQL string.
-For more information view documentation for `$this->get_compiled_insert()`_.
+For more information view documentation for `$this->db->get_compiled_insert()`_.
***************
Method Chaining
@@ -878,8 +925,6 @@ multiple functions. Consider this example::
->limit(10, 20)
->get('mytable');
-.. note:: Method chaining only works with PHP 5.
-
.. _ar-caching:
*********************
@@ -920,11 +965,11 @@ Here's a usage example::
$this->db->stop_cache();
$this->db->get('tablename');
//Generates: SELECT `field1` FROM (`tablename`)
-
+
$this->db->select('field2');
$this->db->get('tablename');
//Generates: SELECT `field1`, `field2` FROM (`tablename`)
-
+
$this->db->flush_cache();
$this->db->select('field2');
$this->db->get('tablename');
@@ -935,18 +980,16 @@ Here's a usage example::
where, like, group_by, having, order_by, set
+$this->db->reset_query()
+========================
-*******************
-Reset Active Record
-*******************
-
-Resetting Active Record 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
+Resetting Active Record 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`_.
-This is useful in situations where you are using Active Record to generate SQL
-(ex. ``$this->db->get_compiled_select()``) but then choose to, for instance,
+This is useful in situations where you are using Active Record to generate SQL
+(ex. ``$this->db->get_compiled_select()``) but then choose to, for instance,
run the query::
// Note that the second parameter of the get_compiled_select method is FALSE
diff --git a/user_guide_src/source/database/configuration.rst b/user_guide_src/source/database/configuration.rst
index 687f0d920..4f88c25ab 100644
--- a/user_guide_src/source/database/configuration.rst
+++ b/user_guide_src/source/database/configuration.rst
@@ -28,6 +28,48 @@ prototype::
$db['default']['autoinit'] = TRUE;
$db['default']['stricton'] = FALSE;
+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::
+
+ $db['default']['failover'] = array(
+ array(
+ 'hostname' => 'localhost1',
+ 'username' => '',
+ 'password' => '',
+ 'database' => '',
+ 'dbdriver' => 'mysql',
+ 'dbprefix' => '',
+ 'pconnect' => TRUE,
+ 'db_debug' => TRUE,
+ 'cache_on' => FALSE,
+ 'cachedir' => '',
+ 'char_set' => 'utf8',
+ 'dbcollat' => 'utf8_general_ci',
+ 'swap_pre' => '',
+ 'autoinit' => TRUE,
+ 'stricton' => FALSE
+ ),
+ array(
+ 'hostname' => 'localhost2',
+ 'username' => '',
+ 'password' => '',
+ 'database' => '',
+ 'dbdriver' => 'mysql',
+ 'dbprefix' => '',
+ 'pconnect' => TRUE,
+ 'db_debug' => TRUE,
+ 'cache_on' => FALSE,
+ 'cachedir' => '',
+ 'char_set' => 'utf8',
+ 'dbcollat' => 'utf8_general_ci',
+ 'swap_pre' => '',
+ 'autoinit' => TRUE,
+ 'stricton' => FALSE
+ )
+ );
+
+You can specify as many failovers as you like.
+
The reason we use a multi-dimensional array rather than a more simple
one is to permit you to optionally store multiple sets of connection
values. If, for example, you run multiple environments (development,
@@ -116,6 +158,7 @@ Explanation of Values:
while developing an application.
**port** The database port number. To use this value you have to add a line to the database config array.
::
+
$db['default']['port'] = 5432;
====================== ==================================================================================================
diff --git a/user_guide_src/source/database/connecting.rst b/user_guide_src/source/database/connecting.rst
index 64adc3047..a834cc0f7 100644
--- a/user_guide_src/source/database/connecting.rst
+++ b/user_guide_src/source/database/connecting.rst
@@ -57,7 +57,19 @@ file.
To connect manually to a desired database you can pass an array of
values::
- $config['hostname'] = "localhost"; $config['username'] = "myusername"; $config['password'] = "mypassword"; $config['database'] = "mydatabase"; $config['dbdriver'] = "mysql"; $config['dbprefix'] = ""; $config['pconnect'] = FALSE; $config['db_debug'] = TRUE; $config['cache_on'] = FALSE; $config['cachedir'] = ""; $config['char_set'] = "utf8"; $config['dbcollat'] = "utf8_general_ci"; $this->load->database($config);
+ $config['hostname'] = "localhost";
+ $config['username'] = "myusername";
+ $config['password'] = "mypassword";
+ $config['database'] = "mydatabase";
+ $config['dbdriver'] = "mysql";
+ $config['dbprefix'] = "";
+ $config['pconnect'] = FALSE;
+ $config['db_debug'] = TRUE;
+ $config['cache_on'] = FALSE;
+ $config['cachedir'] = "";
+ $config['char_set'] = "utf8";
+ $config['dbcollat'] = "utf8_general_ci";
+ $this->load->database($config);
For information on each of these values please see the :doc:`configuration
page <configuration>`.
@@ -68,14 +80,16 @@ page <configuration>`.
Or you can submit your database values as a Data Source Name. DSNs must
have this prototype::
- $dsn = 'dbdriver://username:password@hostname/database'; $this->load->database($dsn);
+ $dsn = 'dbdriver://username:password@hostname/database';
+ $this->load->database($dsn);
To override default config values when connecting with a DSN string, add
the config variables as a query string.
::
- $dsn = 'dbdriver://username:password@hostname/database?char_set=utf8&dbcollat=utf8_general_ci&cache_on=true&cachedir=/path/to/cache'; $this->load->database($dsn);
+ $dsn = 'dbdriver://username:password@hostname/database?char_set=utf8&dbcollat=utf8_general_ci&cache_on=true&cachedir=/path/to/cache';
+ $this->load->database($dsn);
Connecting to Multiple Databases
================================
@@ -83,7 +97,8 @@ Connecting to Multiple Databases
If you need to connect to more than one database simultaneously you can
do so as follows::
- $DB1 = $this->load->database('group_one', TRUE); $DB2 = $this->load->database('group_two', TRUE);
+ $DB1 = $this->load->database('group_one', TRUE);
+ $DB2 = $this->load->database('group_two', TRUE);
Note: Change the words "group_one" and "group_two" to the specific
group names you are connecting to (or you can pass the connection values
diff --git a/user_guide_src/source/general/urls.rst b/user_guide_src/source/general/urls.rst
index 211537675..3126fcf36 100644
--- a/user_guide_src/source/general/urls.rst
+++ b/user_guide_src/source/general/urls.rst
@@ -45,12 +45,13 @@ method in which everything is redirected except the specified items:
::
- RewriteEngine on
- RewriteCond $1 !^(index\.php|images|robots\.txt)
+ RewriteEngine On
+ RewriteCond %{REQUEST_FILENAME} !-f
+ RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php/$1 [L]
-In the above example, any HTTP request other than those for index.php,
-images, and robots.txt is treated as a request for your index.php file.
+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.
Adding a URL Suffix
===================
diff --git a/user_guide_src/source/helpers/inflector_helper.rst b/user_guide_src/source/helpers/inflector_helper.rst
index cf246b9de..cc46a1851 100644
--- a/user_guide_src/source/helpers/inflector_helper.rst
+++ b/user_guide_src/source/helpers/inflector_helper.rst
@@ -77,3 +77,9 @@ them. Each word is capitalized. Example
$word = "my_dog_spot";
echo humanize($word); // Returns "My Dog Spot"
+To use dashes instead of underscores
+
+::
+
+ $word = "my-dog-spot";
+ echo humanize($word, '-'); // Returns "My Dog Spot" \ No newline at end of file
diff --git a/user_guide_src/source/helpers/string_helper.rst b/user_guide_src/source/helpers/string_helper.rst
index b8a69e036..dc70e461a 100644
--- a/user_guide_src/source/helpers/string_helper.rst
+++ b/user_guide_src/source/helpers/string_helper.rst
@@ -58,7 +58,7 @@ Usage example
echo increment_string('file', '_'); // "file_1"
echo increment_string('file', '-', 2); // "file-2"
- echo increment_string('file-4'); // "file-5"
+ echo increment_string('file_4'); // "file_5"
alternator()
============
diff --git a/user_guide_src/source/helpers/text_helper.rst b/user_guide_src/source/helpers/text_helper.rst
index e97643275..8cb2d6f96 100644
--- a/user_guide_src/source/helpers/text_helper.rst
+++ b/user_guide_src/source/helpers/text_helper.rst
@@ -46,6 +46,9 @@ more or less then what you specify. Example
The third parameter is an optional suffix added to the string, if
undeclared this helper uses an ellipsis.
+**Note:** If you need to truncate to an exact number of characters please see
+the :ref:`ellipsize` function below.
+
ascii_to_entities()
===================
@@ -136,6 +139,8 @@ complete words. Example
// Would produce: Here is a simple string of text that will help us demonstrate this function
+.. _ellipsize:
+
ellipsize()
===========
diff --git a/user_guide_src/source/helpers/url_helper.rst b/user_guide_src/source/helpers/url_helper.rst
index c72558705..e6d51b22b 100644
--- a/user_guide_src/source/helpers/url_helper.rst
+++ b/user_guide_src/source/helpers/url_helper.rst
@@ -284,23 +284,24 @@ redirect()
==========
Does a "header redirect" to the URI specified. If you specify the full
-site URL that link will be build, but for local links simply providing
+site URL that link will be built, but for local links simply providing
the URI segments to the controller you want to direct to will create the
link. The function will build the URL based on your config file values.
-The optional second parameter allows you to choose between the
-"location" method (default) or the "refresh" method. Location is faster,
-but on Windows servers it can sometimes be a problem. The optional third
-parameter allows you to send a specific HTTP Response Code - this could
-be used for example to create 301 redirects for search engine purposes.
-The default Response Code is 302. The third parameter is *only*
-available with 'location' redirects, and not 'refresh'. Examples
+The optional second parameter allows you to force a particular redirection
+method. The available methods are "location" or "refresh", with location
+being faster but less reliable on Windows servers. The default is "auto",
+which will attempt to intelligently choose the method based on the server
+environment.
-::
+The optional third parameter allows you to send a specific HTTP Response
+Code - this could be used for example to create 301 redirects for search
+engine purposes. The default Response Code is 302. The third parameter is
+*only* available with 'location' redirects, and not 'refresh'. Examples::
if ($logged_in == FALSE)
{      
- redirect('/login/form/', 'refresh');
+ redirect('/login/form/');
}
// with 301 redirect
diff --git a/user_guide_src/source/installation/upgrade_300.rst b/user_guide_src/source/installation/upgrade_300.rst
new file mode 100644
index 000000000..960485ae3
--- /dev/null
+++ b/user_guide_src/source/installation/upgrade_300.rst
@@ -0,0 +1,28 @@
+#############################
+Upgrading from 2.1.0 to 3.0.0
+#############################
+
+.. note:: These upgrade notes are for a version that is yet to be released.
+
+
+Before performing an update you should take your site offline by
+replacing the index.php file with a static one.
+
+Step 1: Update your CodeIgniter files
+=====================================
+
+Replace all files and directories in your "system" folder and replace
+your index.php file. If any modifications were made to your index.php
+they will need to be made fresh in this new one.
+
+Step 2: Change References to the SHA Library
+============================================
+
+The previously deprecated SHA library has been removed in CodeIgniter 3.0.
+Alter your code to use the native `sha1()` PHP function to generate a sha1 hash.
+
+Additionally, the `sha1()` method in the :doc:`Encryption Library <../libraries/encryption>` has been removed.
+
+
+.. note:: If you have any custom developed files in these folders please
+ make copies of them first.
diff --git a/user_guide_src/source/libraries/cart.rst b/user_guide_src/source/libraries/cart.rst
index 850d7e9a8..6594b3b9a 100644
--- a/user_guide_src/source/libraries/cart.rst
+++ b/user_guide_src/source/libraries/cart.rst
@@ -256,23 +256,31 @@ $this->cart->update();
Permits you to update items in the shopping cart, as outlined above.
+$this->cart->remove(rowid);
+***************************
+
+Allows you to remove an item from the shopping cart by passing it the rowid.
+
$this->cart->total();
*********************
Displays the total amount in the cart.
$this->cart->total_items();
-****************************
+***************************
Displays the total number of items in the cart.
-$this->cart->contents();
-************************
+$this->cart->contents(boolean);
+*******************************
-Returns an array containing everything in the cart.
+Returns an array containing everything in the cart. You can sort the order,
+by which this is returned by passing it "true" where the contents will be sorted
+from newest to oldest, by leaving this function blank, you'll automatically just get
+first added to the basket to last added to the basket.
$this->cart->has_options(rowid);
-*********************************
+********************************
Returns TRUE (boolean) if a particular row in the cart contains options.
This function is designed to be used in a loop with
@@ -280,7 +288,7 @@ $this->cart->contents(), since you must pass the rowid to this function,
as shown in the Displaying the Cart example above.
$this->cart->product_options(rowid);
-*************************************
+************************************
Returns an array of options for a particular product. This function is
designed to be used in a loop with $this->cart->contents(), since you
diff --git a/user_guide_src/source/libraries/email.rst b/user_guide_src/source/libraries/email.rst
index 759899242..27b704dae 100644
--- a/user_guide_src/source/libraries/email.rst
+++ b/user_guide_src/source/libraries/email.rst
@@ -228,7 +228,11 @@ use the function multiple times. For example::
$this->email->attach('/path/to/photo2.jpg');
$this->email->attach('/path/to/photo3.jpg');
- $this->email->send();
+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');
+
$this->email->print_debugger()
-------------------------------
diff --git a/user_guide_src/source/libraries/encryption.rst b/user_guide_src/source/libraries/encryption.rst
index 80b45e4d7..28bdca203 100644
--- a/user_guide_src/source/libraries/encryption.rst
+++ b/user_guide_src/source/libraries/encryption.rst
@@ -126,21 +126,6 @@ Example::
Please visit php.net for a list of `available
modes <http://php.net/mcrypt>`_.
-$this->encrypt->sha1();
-=======================
-
-SHA1 encoding function. Provide a string and it will return a 160 bit
-one way hash. Note: SHA1, just like MD5 is non-decodable. Example::
-
- $hash = $this->encrypt->sha1('Some string');
-
-Many PHP installations have SHA1 support by default so if all you need
-is to encode a hash it's simpler to use the native function::
-
- $hash = sha1('Some string');
-
-If your server does not support SHA1 you can use the provided function.
-
$this->encrypt->encode_from_legacy($orig_data, $legacy_mode = MCRYPT_MODE_ECB, $key = '');
==========================================================================================
diff --git a/user_guide_src/source/libraries/image_lib.rst b/user_guide_src/source/libraries/image_lib.rst
index 300cbef31..ed6575c62 100644
--- a/user_guide_src/source/libraries/image_lib.rst
+++ b/user_guide_src/source/libraries/image_lib.rst
@@ -360,7 +360,7 @@ Preference Default Value Options Description
image headers.
**quality** 90% 1 - 100% Sets the quality of the image. The higher the quality the larger the
file size.
-**padding** None A number The amount of padding, set in pixels, that will be applied to the
+**wm_padding** None A number The amount of padding, set in pixels, that will be applied to the
watermark to set it away from the edge of your images.
**wm_vrt_alignment** bottom top, middle, bottom Sets the vertical alignment for the watermark image.
**wm_hor_alignment** center left, center, right Sets the horizontal alignment for the watermark image.
@@ -390,13 +390,11 @@ Preference Default Value Options Description
**wm_font_size** 16 None The size of the text. Note: If you are not using the True Type option
above, the number is set using a range of 1 - 5. Otherwise, you can use
any valid pixel size for the font you're using.
-**wm_font_color** ffffff None The font color, specified in hex. Note, you must use the full 6
- character hex value (ie, 993300), rather than the three character
- abbreviated version (ie fff).
+**wm_font_color** ffffff None The font color, specified in hex. Both the full 6-length (ie, 993300) and
+ the short three character abbreviated version (ie, fff) are supported.
**wm_shadow_color** None None The color of the drop shadow, specified in hex. If you leave this blank
- a drop shadow will not be used. Note, you must use the full 6 character
- hex value (ie, 993300), rather than the three character abbreviated
- version (ie fff).
+ a drop shadow will not be used. Both the full 6-length (ie, 993300) and
+ the short three character abbreviated version (ie, fff) are supported.
**wm_shadow_distance** 3 None The distance (in pixels) from the font that the drop shadow should
appear.
======================= =================== =================== ==========================================================================
diff --git a/user_guide_src/source/libraries/loader.rst b/user_guide_src/source/libraries/loader.rst
index bbe2ed530..2090404bf 100644
--- a/user_guide_src/source/libraries/loader.rst
+++ b/user_guide_src/source/libraries/loader.rst
@@ -165,6 +165,12 @@ This function checks the associative array of variables available to
your views. This is useful if for any reason a var is set in a library
or another controller method using $this->load->vars().
+$this->load->get_vars()
+===========================
+
+This function retrieves all variables available to
+your views.
+
$this->load->helper('file_name')
=================================
diff --git a/user_guide_src/source/libraries/migration.rst b/user_guide_src/source/libraries/migration.rst
new file mode 100644
index 000000000..5192f1f29
--- /dev/null
+++ b/user_guide_src/source/libraries/migration.rst
@@ -0,0 +1,5 @@
+################
+Migrations Class
+################
+
+Coming soon. \ No newline at end of file
diff --git a/user_guide_src/source/tutorial/create_news_items.rst b/user_guide_src/source/tutorial/create_news_items.rst
index 003b94bd8..794b67eed 100644
--- a/user_guide_src/source/tutorial/create_news_items.rst
+++ b/user_guide_src/source/tutorial/create_news_items.rst
@@ -2,7 +2,7 @@
Create news items
#################
-You now know how you can read data from a database using CodeIgnite, but
+You now know how you can read data from a database using CodeIgniter, but
you haven't written any information to the database yet. In this section
you'll expand your news controller and model created earlier to include
this functionality.
diff --git a/user_guide_src/source/tutorial/news_section.rst b/user_guide_src/source/tutorial/news_section.rst
index fe8e41607..38e4214ca 100644
--- a/user_guide_src/source/tutorial/news_section.rst
+++ b/user_guide_src/source/tutorial/news_section.rst
@@ -149,7 +149,7 @@ and add the next piece of code.
<div id="main">
<?php echo $news_item['text'] ?>
</div>
- <p><a href="news/<?php echo $news_item['slug'] ?>">View article</a></p>
+ <p><a href="<?php echo $news_item['slug'] ?>">View article</a></p>
<?php endforeach ?>
diff --git a/user_guide_src/source/tutorial/static_pages.rst b/user_guide_src/source/tutorial/static_pages.rst
index 0bbf51b1b..c7f737951 100644
--- a/user_guide_src/source/tutorial/static_pages.rst
+++ b/user_guide_src/source/tutorial/static_pages.rst
@@ -28,7 +28,7 @@ code.
<?php
class Pages extends CI_Controller {
- public function view($page == 'home')
+ public function view($page = 'home')
{
}
@@ -62,7 +62,7 @@ following code.
</head>
<body>
- <h1>CodeIgniter 2 Tutorial<h1>
+ <h1>CodeIgniter 2 Tutorial</h1>
The header contains the basic HTML code that you'll want to display
before loading the main view, together with a heading. It will also
@@ -72,7 +72,7 @@ includes the following code:
::
- <em>&copy; 2011</em>
+ <em>&copy; 2012</em>
</body>
<html>