diff options
Diffstat (limited to 'user_guide')
-rw-r--r-- | user_guide/changelog.html | 8 | ||||
-rw-r--r-- | user_guide/database/active_record.html | 2 | ||||
-rw-r--r-- | user_guide/database/forge.html | 2 | ||||
-rw-r--r-- | user_guide/libraries/caching.html | 193 | ||||
-rw-r--r-- | user_guide/libraries/user_agent.html | 25 |
5 files changed, 227 insertions, 3 deletions
diff --git a/user_guide/changelog.html b/user_guide/changelog.html index 013468f6f..3fd2a465a 100644 --- a/user_guide/changelog.html +++ b/user_guide/changelog.html @@ -77,6 +77,10 @@ Hg Tag: </p> <li>In-development code is now hosted at <a href="http://bitbucket.org/ellislab/codeigniter/">BitBucket</a>.</li> <li>Removed the deprecated Validation Class.</li> <li>Added CI_ Prefix to all core classes.</li> + <li>Package paths can now be set in application/config/autoload.php.</li> + <li>Upload library file_name can now be set without an extension, the extension will be taken from the uploaded file instead of the given name.</li> + <li>Name can be omitted from $this->dbforge->modify_column()'s 2nd param if you aren't changing the name.</li> + <li><kbd>$config['base_url']</kbd> is now empty by default and will guess what it should be.</li> </ul> <li>Libraries <ul> @@ -110,6 +114,7 @@ Hg Tag: </p> <li>Altered Form_Validation library to allow for method chaining on <kbd>set_rules()</kbd>, <kbd>set_message()</kbd> and <kbd>set_error_delimiters()</kbd> functions.</li> <li>Altered Email Library to allow for method chaining.</li> <li>Added <kbd>request_headers()</kbd>, <kbd>get_request_header()</kbd> and <kbd>is_ajax_request()</kbd> to the input class.</li> + <li>Altered <a href="libraries/user_agent.html">User agent library</a> so that <kbd>is_browser()</kbd>, <kbd>is_mobile()</kbd> and <kbd>is_robot()</kbd> can optionally check for a specific browser or mobile device.</li> </ul> </li> <li>Database @@ -171,6 +176,7 @@ Hg Tag: </p> <h3>Bug fixes for 2.0.0</h3> <ul> + <li>Fixed a bug where you could not change the User-Agent when sending email.</li> <li>Fixed a bug where the Output class would send incorrect cached output for controllers implementing their own <dfn>_output()</dfn> method.</li> <li>Fixed a bug where a failed query would not have a saved query execution time causing errors in the Profiler</li> <li>Fixed a bug that was writing log entries when multiple identical helpers and plugins were loaded.</li> @@ -752,7 +758,7 @@ Hg Tag: 1.6.1</p> </ul> </li> - + <li>Documentation Changes <ul> <li>Added <a href="./doc_style/index.html">Writing Documentation</a> section for the community to use in writing their own documentation.</li> diff --git a/user_guide/database/active_record.html b/user_guide/database/active_record.html index 065db4913..9ae93a9ae 100644 --- a/user_guide/database/active_record.html +++ b/user_guide/database/active_record.html @@ -736,7 +736,7 @@ $this->db->get('tablename');<br /> <br /> //Generates: SELECT `field2` FROM (`tablename`)</code></p> -<p class="important"> <strong>Note:</strong> The following statements can be cached: select, from, join, where, like, groupby, having, orderby, set</p> +<p class="important"> <strong>Note:</strong> The following statements can be cached: select, from, join, where, like, group_by, having, order_by, set</p> <p> </p> </div> <!-- END CONTENT --> diff --git a/user_guide/database/forge.html b/user_guide/database/forge.html index 28b32d96a..b9e04428c 100644 --- a/user_guide/database/forge.html +++ b/user_guide/database/forge.html @@ -205,7 +205,7 @@ $this->dbforge->add_column('table_name', $fields);<br /> <p>Used to remove a column from a table. </p> <p><code>$this->dbforge->drop_column('table_name', 'column_to_drop');</code></p> <h2>$this->dbforge->modify_column()</h2> -<p>The usage of this function is identical to add_column(), except it alters an existing column rather than adding a new one. In order to use it you must add a "name" key into the field defining array.</p> +<p>The usage of this function is identical to add_column(), except it alters an existing column rather than adding a new one. In order to change the name you can add a "name" key into the field defining array.</p> <p><code>$fields = array(<br /> 'old_name' => array(<br /> 'name' => 'new_name',<br /> diff --git a/user_guide/libraries/caching.html b/user_guide/libraries/caching.html new file mode 100644 index 000000000..e4651dc4a --- /dev/null +++ b/user_guide/libraries/caching.html @@ -0,0 +1,193 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> +<head> + +<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> +<title>Caching Driver : CodeIgniter User Guide</title> + +<style type='text/css' media='all'>@import url('../userguide.css');</style> +<link rel='stylesheet' type='text/css' media='all' href='../userguide.css' /> + +<script type="text/javascript" src="../nav/nav.js"></script> +<script type="text/javascript" src="../nav/prototype.lite.js"></script> +<script type="text/javascript" src="../nav/moo.fx.js"></script> +<script type="text/javascript" src="../nav/user_guide_menu.js"></script> + +<meta http-equiv='expires' content='-1' /> +<meta http-equiv= 'pragma' content='no-cache' /> +<meta name='robots' content='all' /> +<meta name='author' content='ExpressionEngine Dev Team' /> +<meta name='description' content='CodeIgniter User Guide' /> + +</head> +<body> + +<!-- START NAVIGATION --> +<div id="nav"><div id="nav_inner"><script type="text/javascript">create_menu('../');</script></div></div> +<div id="nav2"><a name="top"></a><a href="javascript:void(0);" onclick="myHeight.toggle();"><img src="../images/nav_toggle_darker.jpg" width="154" height="43" border="0" title="Toggle Table of Contents" alt="Toggle Table of Contents" /></a></div> +<div id="masthead"> +<table cellpadding="0" cellspacing="0" border="0" style="width:100%"> +<tr> +<td><h1>CodeIgniter User Guide Version 2.0.0</h1></td> +<td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td> +</tr> +</table> +</div> +<!-- END NAVIGATION --> + + +<!-- START BREADCRUMB --> +<table cellpadding="0" cellspacing="0" border="0" style="width:100%"> +<tr> +<td id="breadcrumb"> +<a href="http://codeigniter.com/">CodeIgniter Home</a> › +<a href="../index.html">User Guide Home</a> › +<a href="../general/drivers.html">Drivers</a> › +Caching Driver +</td> +<td id="searchbox"><form method="get" action="http://www.google.com/search"><input type="hidden" name="as_sitesearch" id="as_sitesearch" value="codeigniter.com/user_guide/" />Search User Guide <input type="text" class="input" style="width:200px;" name="q" id="q" size="31" maxlength="255" value="" /> <input type="submit" class="submit" name="sa" value="Go" /></form></td> +</tr> +</table> +<!-- END BREADCRUMB --> + +<br clear="all" /> + + +<!-- START CONTENT --> +<div id="content"> + +<h1>Caching Driver</h1> + +<p>CodeIgniter features wrappers around some of the most popular forms of fast and dynamic caching. All but file-based caching require specific server requirements, and a Fatal Exception will be thrown if server requirements are not met.</p> + +<h2>Table of Contents</h2> +<ul> + <li><a href="#example_usage" title="Example Usage">Example Usage</a></li> + <li><a href="#function_reference" title="Function Reference">Function Reference</a></li> +</ul> + +<h3>Available Drivers</h3> +<ul> + <li><a href="#apc" title="APC Cache">Alternative PHP Cache (APC) Caching</a></li> + <li><a href="#file" title="File Caching">File-based Caching</a></li> + <li><a href="#memcached" title="Memcached">Memcached Caching</a></li> + <li><a href="#dummy" title="Dummy Caching">Dummy Cache</a></li> +</ul> + +<h2 id="example_usage">Example Usage</h2> + +<p>The following example will load the cache driver, specify <a href="#apc" title="APC">APC</a> as the driver to use, and fall back to file-based caching if APC is not available in the hosting environment.</p> + +<code> +$this->load->driver('cache', array('adapter' => 'apc', 'backup' => 'file'));<br /> +<br /> +if ( ! $foo = $this->cache->get('foo'))<br /> +{<br /> + echo 'Saving to the cache!<br />';<br /> + $foo = 'foobarbaz!';<br /> +<br /> + // Save into the cache for 5 minutes<br /> + $this->cache->save('foo', $foo, 300);<br /> +}<br /> +<br /> +echo $foo; +</code> + +<h1 id="function_reference">Function Reference</h1> + +<h2>is_supported(<var>driver</var>['string'])</h2> + +<p>This function is automatically called when accessing drivers via <samp>$this->cache->get()</samp>. However, if the individual drivers are used, make sure to call this function to ensure the driver is supported in the hosting environment.</p> + +<code> +if ($this->cache->apc->is_supported())<br /> +{<br /> + if ($data = $this->cache->apc->get('my_cache'))<br /> + {<br /> + // do things.<br /> + }<br /> +} +</code> + +<h2>get(<var>id</var>['string'])</h2> + +<p>This function will attempt to fetch an item from the cache store. If the item does not exist, the function will return <samp>FALSE</samp>.</p> +<code>$foo = $this->cache->get('my_cached_item');</code> + +<h2>save(<var>id</var>['string'], <var>data</var>['mixed'], <var>ttl</var>['int'])</h2> + +<p>This function will save an item to the cache store. If saving fails, the function will return <samp>FALSE</samp>.</p> +<p>The optional third parameter (Time To Live) defaults to 60 seconds.</p> +<code>$this->cache->save('cache_item_id', 'data_to_cache');</code> + +<h2>delete(<var>id</var>['string'])</h2> + +<p>This function will delete a specific item from the cache store. If item deletion fails, the function will return <samp>FALSE</samp>.</p> +<code>$this->cache->delete('cache_item_id');</code> + +<h2>clean()</h2> + +<p>This function will 'clean' the entire cache. If the deletion of the cache files fails, the function will return <samp>FALSE</samp>.</p> + +<code>$this->cache->clean();</code> + +<h2>cache_info()</h2> + +<p>This function will return information on the entire cache.</p> + +<code>var_dump($this->cache->cache_info());</code> + +<h2>get_metadata(<var>id</var>['string'])</h2> + +<p>This function will return detailed information on a specific item in the cache.</p> + +<code>var_dump($this->cache->get_metadata('my_cached_item'));</code> + +<h1>Drivers</h1> + +<h2 id="apc">Alternative PHP Cache (APC) Caching</h2> + +<p>All of the functions listed above can be accessed without passing a specific adapter to the driver loader as follows:</p> +<code>$this->load->driver('cache');<br /> + $this->cache->apc->save('foo', 'bar', 10);</code> +<p>For more information on APC, please see <a href="http://php.net/apc">http://php.net/apc</a></p> + +<h2 id="file">File-based Caching</h2> + +<p>Unlike caching from the Output Class, the driver file-based caching allows for pieces of view files to be cached. Use this with care, and make sure to benchmark your application, as a point can come where disk I/O will negate positive gains by caching.</p> + +<p>All of the functions listed above can be accessed without passing a specific adapter to the driver loader as follows:</p> +<code>$this->load->driver('cache');<br /> + $this->cache->file->save('foo', 'bar', 10);</code> + +<h2 id="memcached">Memcached Caching</h2> + +<p>Multiple Memcached servers can be specified in the memcached.php configuration file, located in the <samp>application/config/</samp> directory. + +<p>All of the functions listed above can be accessed without passing a specific adapter to the driver loader as follows:</p> +<code>$this->load->driver('cache');<br /> + $this->cache->memcached->save('foo', 'bar', 10);</code> + +<p>For more information on Memcached, please see <a href="http://php.net/memcached">http://php.net/memcached</a></p> + +<h2 id="dummy">Dummy Cache</h2> + +<p>This is a caching backend that will always 'miss.' It stores no data, but lets you keep your caching code in place in environments that don't support your chosen cache.</p> + +</div> +<!-- END CONTENT --> + + +<div id="footer"> +<p> +Previous Topic: <a href="errors.html">Error Handling</a> + · +<a href="#top">Top of Page</a> · +<a href="../index.html">User Guide Home</a> · +Next Topic: <a href="profiling.html">Profiling Your Application</a> +</p> +<p><a href="http://codeigniter.com">CodeIgniter</a> · Copyright © 2006-2010 · <a href="http://ellislab.com/">EllisLab, Inc.</a></p> +</div> + +</body> +</html>
\ No newline at end of file diff --git a/user_guide/libraries/user_agent.html b/user_guide/libraries/user_agent.html index 944f1ed86..d2f79d2ec 100644 --- a/user_guide/libraries/user_agent.html +++ b/user_guide/libraries/user_agent.html @@ -111,9 +111,34 @@ echo $this->agent->platform(); // Platform info (Windows, Linux, Mac, etc.) <h2>$this->agent->is_browser()</h2> <p>Returns TRUE/FALSE (boolean) if the user agent is a known web browser.</p> +<code> if ($this->agent->is_browser('Safari'))<br /> +{<br /> + echo 'You are using Safari.';<br /> +}<br /> +else if ($this->agent->is_browser())<br /> +{<br /> + echo 'You are using a browser.';<br /> +}</code> + +<p class="important"><strong>Note:</strong> The string "Safari" in this example is an array key in the list of browser definitions. +You can find this list in <dfn>application/config/user_agents.php</dfn> if you want to add new browsers or change the stings.</p> + <h2>$this->agent->is_mobile()</h2> <p>Returns TRUE/FALSE (boolean) if the user agent is a known mobile device.</p> +<code> if ($this->agent->is_mobile('iphone'))<br /> +{<br /> + $this->load->view('iphone/home');<br /> +}<br /> +else if ($this->agent->is_mobile())<br /> +{<br /> + $this->load->view('mobile/home');<br /> +}<br/> +else<br /> +{<br /> + $this->load->view('web/home');<br /> +}</code> + <h2>$this->agent->is_robot()</h2> <p>Returns TRUE/FALSE (boolean) if the user agent is a known robot.</p> |