diff options
Diffstat (limited to 'user_guide_src')
-rw-r--r-- | user_guide_src/source/changelog.rst | 3 | ||||
-rw-r--r-- | user_guide_src/source/database/query_builder.rst | 37 | ||||
-rw-r--r-- | user_guide_src/source/general/caching.rst | 12 | ||||
-rw-r--r-- | user_guide_src/source/libraries/output.rst | 30 |
4 files changed, 56 insertions, 26 deletions
diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst index ab1d99dab..6570eb790 100644 --- a/user_guide_src/source/changelog.rst +++ b/user_guide_src/source/changelog.rst @@ -294,8 +294,9 @@ Release Date: Not Released - 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>`. - :doc:`Output Library <libraries/output>` changes include: - - Added method ``get_content_type()``. - Added a second argument to method ``set_content_type()`` that allows setting the document charset as well. + - Added methods ``get_content_type()`` and ``get_header()``. + - Added method ``delete_cache()``. - ``$config['time_reference']`` now supports all timezone strings supported by PHP. - :doc:`Config Library <libraries/config>` changes include: - Changed ``site_url()`` method to accept an array as well. diff --git a/user_guide_src/source/database/query_builder.rst b/user_guide_src/source/database/query_builder.rst index 8fb906052..65609c1cb 100644 --- a/user_guide_src/source/database/query_builder.rst +++ b/user_guide_src/source/database/query_builder.rst @@ -345,23 +345,24 @@ if appropriate $this->db->like() ================= -This function enables you to generate **LIKE** clauses, useful for doing +This method enables you to generate **LIKE** clauses, useful for doing searches. -.. note:: All values passed to this function are escaped automatically. +.. note:: All values passed to this method are escaped automatically. #. **Simple key/value method:** :: - $this->db->like('title', 'match'); // Produces: WHERE title LIKE '%match%' + $this->db->like('title', 'match'); + // Produces: WHERE `title` LIKE '%match%' ESCAPE '!' - If you use multiple function calls they will be chained together with + If you use multiple method calls they will be chained together with AND between them:: $this->db->like('title', 'match'); $this->db->like('body', 'match'); - // WHERE title LIKE '%match%' AND body LIKE '%match% + // WHERE `title` LIKE '%match%' ESCAPE '!' AND `body` LIKE '%match% ESCAPE '!' If you want to control where the wildcard (%) is placed, you can use an optional third argument. Your options are 'before', 'after' and @@ -369,9 +370,9 @@ 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', 'before'); // Produces: WHERE `title` LIKE '%match' ESCAPE '!' + $this->db->like('title', 'match', 'after'); // Produces: WHERE `title` LIKE 'match%' ESCAPE '!' + $this->db->like('title', 'match', 'both'); // Produces: WHERE `title` LIKE '%match%' ESCAPE '!' #. **Associative array method:** @@ -379,37 +380,37 @@ searches. $array = array('title' => $match, 'page1' => $match, 'page2' => $match); $this->db->like($array); - // WHERE title LIKE '%match%' AND page1 LIKE '%match%' AND page2 LIKE '%match%' + // WHERE `title` LIKE '%match%' ESCAPE '!' AND `page1` LIKE '%match%' ESCAPE '!' AND `page2` LIKE '%match%' ESCAPE '!' $this->db->or_like() ==================== -This function is identical to the one above, except that multiple +This method is identical to the one above, except that multiple instances are joined by OR:: $this->db->like('title', 'match'); $this->db->or_like('body', $match); - // WHERE title LIKE '%match%' OR body LIKE '%match%' + // WHERE `title` LIKE '%match%' ESCAPE '!' OR `body` LIKE '%match%' ESCAPE '!' -.. note:: or_like() was formerly known as orlike(), which has been removed. +.. note:: ``or_like()`` was formerly known as ``orlike()``, which has been removed. $this->db->not_like() ===================== -This function is identical to **like()**, except that it generates NOT -LIKE statements:: +This method is identical to ``like()``, except that it generates +NOT LIKE statements:: - $this->db->not_like('title', 'match'); // WHERE title NOT LIKE '%match% + $this->db->not_like('title', 'match'); // WHERE `title` NOT LIKE '%match% ESCAPE '!' $this->db->or_not_like() ======================== -This function is identical to **not_like()**, except that multiple +This method is identical to ``not_like()``, except that multiple instances are joined by OR:: $this->db->like('title', 'match'); $this->db->or_not_like('body', 'match'); - // WHERE title LIKE '%match% OR body NOT LIKE '%match%' + // WHERE `title` LIKE '%match% OR `body` NOT LIKE '%match%' ESCAPE '!' $this->db->group_by() ===================== @@ -1054,4 +1055,4 @@ run the query:: $data = $this->db->get()->result_array(); // Would execute and return an array of results of the following query: - // SELECT field1, field1 from mytable where field3 = 5; + // SELECT field1, field1 from mytable where field3 = 5;
\ No newline at end of file diff --git a/user_guide_src/source/general/caching.rst b/user_guide_src/source/general/caching.rst index c40f652ac..48385d6c9 100644 --- a/user_guide_src/source/general/caching.rst +++ b/user_guide_src/source/general/caching.rst @@ -56,5 +56,13 @@ If you no longer wish to cache a file you can remove the caching tag and it will no longer be refreshed when it expires. .. note:: Removing the tag will not delete the cache immediately. It will - have to expire normally. If you need to remove it earlier you - will need to manually delete it from your cache directory.
\ No newline at end of file + have to expire normally. + +If you need to manually delete the cache, you can use the ``delete_cache()`` +method:: + + // Deletes cache for the currently requested URI + $this->output->delete_cache(); + + // Deletes cache for /foo/bar + $this->output->delete_cache('/foo/bar');
\ No newline at end of file diff --git a/user_guide_src/source/libraries/output.rst b/user_guide_src/source/libraries/output.rst index 82b1a56a5..a3d67b847 100644 --- a/user_guide_src/source/libraries/output.rst +++ b/user_guide_src/source/libraries/output.rst @@ -53,17 +53,37 @@ You can also set the character set of the document, by passing a second argument $this->output->set_content_type('css', 'utf-8'); -$this->output->get_content_type(); -========================================== +$this->output->get_content_type() +================================= -Returns the Content-Type HTTP header that's currently in use. +Returns the Content-Type HTTP header that's currently in use, +excluding the character set value. $mime = $this->output->get_content_type(); .. note:: If not set, the default return value is 'text/html'. -$this->output->get_output(); -============================= +$this->output->get_header() +=========================== + +Gets the requested HTTP header value, if set. + +If the header is not set, NULL will be returned. +If an empty value is passed to the method, it will return FALSE. + +Example:: + + $this->output->set_content_type('text/plain', 'UTF-8'); + echo $this->output->get_header('content-type'); + // Outputs: text/plain; charset=utf-8 + +.. note:: The header name is compared in a case-insensitive manner. + +.. note:: Raw headers sent via PHP's native ``header()`` function are + also detected. + +$this->output->get_output() +=========================== Permits you to manually retrieve any output that has been sent for storage in the output class. Usage example:: |