diff options
Diffstat (limited to 'user_guide_src')
-rw-r--r-- | user_guide_src/source/libraries/caching.rst | 56 | ||||
-rw-r--r-- | user_guide_src/source/libraries/form_validation.rst | 56 |
2 files changed, 56 insertions, 56 deletions
diff --git a/user_guide_src/source/libraries/caching.rst b/user_guide_src/source/libraries/caching.rst index 8d7b4c440..ca4ad4935 100644 --- a/user_guide_src/source/libraries/caching.rst +++ b/user_guide_src/source/libraries/caching.rst @@ -20,16 +20,16 @@ available in the hosting environment. :: $this->load->driver('cache', array('adapter' => 'apc', 'backup' => 'file')); - + if ( ! $foo = $this->cache->get('foo')) { echo 'Saving to the cache!<br />'; $foo = 'foobarbaz!'; - + // Save into the cache for 5 minutes $this->cache->save('foo', $foo, 300); } - + echo $foo; You can also prefix cache item names via the **key_prefix** setting, which is useful @@ -47,24 +47,24 @@ to avoid collisions when you're running multiple applications on the same enviro Function Reference ****************** -.. php:class:: CI_Cache +.. class:: CI_Cache is_supported() ============== - .. php:method:: is_supported ( $driver ) + .. method:: is_supported ( $driver ) This function is automatically called when accessing drivers via $this->cache->get(). However, if the individual drivers are used, make sure to call this function to ensure the driver is supported in the hosting environment. - + :param string $driver: the name of the caching driver :returns: TRUE if supported, FALSE if not :rtype: Boolean - + :: - + if ($this->cache->apc->is_supported() { if ($data = $this->cache->apc->get('my_cache')) @@ -77,15 +77,15 @@ is_supported() get() ===== - .. php:method:: get ( $id ) - + .. method:: get ( $id ) + This function will attempt to fetch an item from the cache store. If the item does not exist, the function will return FALSE. :param string $id: name of cached item :returns: The item if it exists, FALSE if it does not :rtype: Mixed - + :: $foo = $this->cache->get('my_cached_item'); @@ -94,8 +94,8 @@ get() save() ====== - .. php:method:: save ( $id , $data [, $ttl]) - + .. method:: save ( $id , $data [, $ttl]) + This function will save an item to the cache store. If saving fails, the function will return FALSE. @@ -108,19 +108,19 @@ save() :: $this->cache->save('cache_item_id', 'data_to_cache'); - + delete() ======== - .. php:method:: delete ( $id ) - + .. method:: delete ( $id ) + This function will delete a specific item from the cache store. If item deletion fails, the function will return FALSE. :param string $id: name of cached item :returns: TRUE if deleted, FALSE if the deletion fails :rtype: Boolean - + :: $this->cache->delete('cache_item_id'); @@ -128,14 +128,14 @@ delete() clean() ======= - .. php:method:: clean ( ) - + .. method:: clean ( ) + This function will 'clean' the entire cache. If the deletion of the cache files fails, the function will return FALSE. :returns: TRUE if deleted, FALSE if the deletion fails :rtype: Boolean - + :: $this->cache->clean(); @@ -143,33 +143,33 @@ clean() cache_info() ============ - .. php:method:: cache_info ( ) + .. method:: cache_info ( ) This function will return information on the entire cache. :returns: information on the entire cache :rtype: Mixed - + :: var_dump($this->cache->cache_info()); - + .. note:: The information returned and the structure of the data is dependent on which adapter is being used. - + get_metadata() ============== - .. php:method:: get_metadata ( $id ) - + .. method:: get_metadata ( $id ) + This function will return detailed information on a specific item in the cache. - + :param string $id: name of cached item :returns: metadadta for the cached item :rtype: Mixed - + :: var_dump($this->cache->get_metadata('my_cached_item')); diff --git a/user_guide_src/source/libraries/form_validation.rst b/user_guide_src/source/libraries/form_validation.rst index 8b35fdc75..5dffb1cd1 100644 --- a/user_guide_src/source/libraries/form_validation.rst +++ b/user_guide_src/source/libraries/form_validation.rst @@ -477,8 +477,8 @@ following method:: Where rule corresponds to the name of a particular rule, and Error Message is the text you would like displayed. -If you'd like to include a field's "human" name, or the optional -parameter some rules allow for (such as max_length), you can add the +If you'd like to include a field's "human" name, or the optional +parameter some rules allow for (such as max_length), you can add the **{field}** and **{param}** tags to your message, respectively:: $this->form_validation->set_message('min_length', '{field} must have at least {param} characters.'); @@ -860,14 +860,14 @@ 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] -**differs** Yes Returns FALSE if the form element does not differ from the one in the parameter. differs[form_item] -**is_unique** Yes Returns FALSE if the form element is not unique to the table and field name in the is_unique[table.field] - parameter. Note: This rule requires :doc:`Query Builder <../database/query_builder>` to be +**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] +**differs** Yes Returns FALSE if the form element does not differ from the one in the parameter. differs[form_item] +**is_unique** Yes Returns FALSE if the form element is not unique to the table and field name in the is_unique[table.field] + parameter. Note: This rule requires :doc:`Query Builder <../database/query_builder>` to be enabled in order to work. -**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] +**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] @@ -876,15 +876,15 @@ Rule Parameter Description 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** No Returns FALSE if the form element contains anything other than alphabetical characters. **alpha_numeric** No Returns FALSE if the form element contains anything other than alpha-numeric characters. **alpha_numeric_spaces** No Returns FALSE if the form element contains anything other than alpha-numeric characters - or spaces. Should be used after trim to avoid spaces at the beginning or end. -**alpha_dash** No Returns FALSE if the form element contains anything other than alpha-numeric characters, - underscores or dashes. -**numeric** No Returns FALSE if the form element contains anything other than numeric characters. -**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. + or spaces. Should be used after trim to avoid spaces at the beginning or end. +**alpha_dash** No Returns FALSE if the form element contains anything other than alpha-numeric characters, + underscores or dashes. +**numeric** No Returns FALSE if the form element contains anything other than numeric characters. +**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 @@ -933,14 +933,14 @@ Name Parameter Description Class Reference *************** -.. php:class:: Form_validation +.. class:: Form_validation The following methods are intended for use in your controller. $this->form_validation->set_rules() =================================== - .. php:method:: set_rules ($field, $label = '', $rules = '') + .. method:: set_rules ($field, $label = '', $rules = '') :param string $field: The field name :param string $label: The field label @@ -955,8 +955,8 @@ $this->form_validation->set_rules() $this->form_validation->run() ============================= - - .. php:method:: run ($group = '') + + .. method:: run ($group = '') :param string $group: The name of the validation group to run :rtype: Boolean @@ -967,8 +967,8 @@ $this->form_validation->run() $this->form_validation->set_message() ===================================== - - .. php:method:: set_message ($lang, $val = '') + + .. method:: set_message ($lang, $val = '') :param string $lang: The rule the message is for :param string $val: The message @@ -978,8 +978,8 @@ $this->form_validation->set_message() $this->form_validation->set_data() ================================== - - .. php:method:: set_data ($data = '') + + .. method:: set_data ($data = '') :param array $data: The data to validate @@ -989,15 +989,15 @@ $this->form_validation->set_data() $this->form_validation->reset_validation() ========================================== - .. php:method:: reset_validation () + .. method:: reset_validation () Permits you to reset the validation when you validate more than one array. This method should be called before validating each new array. $this->form_validation->error_array() ===================================== - - .. php:method:: error_array () + + .. method:: error_array () :rtype: Array @@ -1031,7 +1031,7 @@ Shows all error messages as a string: Example:: <?php echo validation_errors(); ?> -The error delimiters can be optionally specified. See the +The error delimiters can be optionally specified. See the :ref:`changing-delimiters` section above. set_value() |