diff options
-rw-r--r-- | system/libraries/Controller.php | 2 | ||||
-rw-r--r-- | system/libraries/Output.php | 22 | ||||
-rw-r--r-- | system/libraries/URI.php | 2 | ||||
-rw-r--r-- | user_guide/general/changelog.html | 14 | ||||
-rw-r--r-- | user_guide/general/controllers.html | 53 | ||||
-rw-r--r-- | user_guide/general/requirements.html | 2 | ||||
-rw-r--r-- | user_guide/libraries/calendar.html | 2 |
7 files changed, 65 insertions, 32 deletions
diff --git a/system/libraries/Controller.php b/system/libraries/Controller.php index 5a32e65c0..0dd6ee6a4 100644 --- a/system/libraries/Controller.php +++ b/system/libraries/Controller.php @@ -380,7 +380,7 @@ class Controller extends CI_Base { eval('class CI_DB extends CI_DB_driver { }'); } } - + require_once(BASEPATH.'drivers/DB_'.$params['dbdriver'].EXT); // Instantiate the DB adapter diff --git a/system/libraries/Output.php b/system/libraries/Output.php index 4a3adb858..ec3660c6c 100644 --- a/system/libraries/Output.php +++ b/system/libraries/Output.php @@ -123,8 +123,8 @@ class CI_Output { */ function _display($output = '') { - $BM =& _load_class('CI_Benchmark'); - + $obj =& get_instance(); + if ($output == '') { $output =& $this->final_output; @@ -138,15 +138,14 @@ class CI_Output { // Parse out the elapsed time and memory usage, and // swap the pseudo-variables with the data - $elapsed = $BM->elapsed_time('code_igniter_start', 'code_igniter_end'); + $elapsed = $obj->benchmark->elapsed_time('code_igniter_start', 'code_igniter_end'); $memory = ( ! function_exists('memory_get_usage')) ? '0' : round(memory_get_usage()/1024/1024, 2).'MB'; $output = str_replace('{memory_usage}', $memory, $output); $output = str_replace('{elapsed_time}', $elapsed, $output); // Is compression requested? - $CFG =& _load_class('CI_Config'); - if ($CFG->item('compress_output') === TRUE) + if ($obj->config->item('compress_output') === TRUE) { if (extension_loaded('zlib')) { @@ -166,8 +165,17 @@ class CI_Output { } } - // Send it to the browser! - echo $output; + // Send the finalized output either directly + // to the browser or to the user's _output() + // function if it exists + if (method_exists($obj, '_output')) + { + $obj->_output($output); + } + else + { + echo $output; // Send it to the browser! + } log_message('debug', "Final output sent to browser"); log_message('debug', "Total execution time: ".$elapsed); diff --git a/system/libraries/URI.php b/system/libraries/URI.php index e831d9526..89ca42e44 100644 --- a/system/libraries/URI.php +++ b/system/libraries/URI.php @@ -280,7 +280,7 @@ class CI_URI { $leading = '/'; $trailing = '/'; } - return ( ! isset($this->router->$which[$n])) ? '' : $leading.$this->router->$which[$n].$trailing; + return $leading.$this->$which($n).$trailing; } // -------------------------------------------------------------------- diff --git a/user_guide/general/changelog.html b/user_guide/general/changelog.html index 23d382fcb..8930ee023 100644 --- a/user_guide/general/changelog.html +++ b/user_guide/general/changelog.html @@ -64,18 +64,18 @@ Change Log <h2>Version 1.4.1</h2>
-<p>Release Date: September 25, 2006</p>
+<p>Release Date: September 21, 2006</p>
<ul>
<li>Added a new feature that passes URI segments directly to your function calls as parameters. See the <a href="controllers.html">Controllers</a> page for more info.</li>
-<li>Added several new functions in the <a href="../libraries/uri.html">URI Class</a> to let you retrieve and manipulate Re-routed URI segments. Previously, the URI class did not permit you to access any re-routed URI segments when you used the <a href="routing.html">URI Routing</a> feature. Now it does.</li>
-<li>Updated plugins, helpers, and language classes to allow your "application" folder to contain its own plugins, helpers, and language folders. If your application folder contains any of these resources, when you load them CI will look first in your local application folder. If not found, it instead looks in the global folders.</li>
-<li>Added <a href="../helpers/inflector_helper.html">Inflector helper</a>.</li>
-<li>Added element() function in the <a href="../helpers/array_helper.html">array helper</a>.</li>
+<li>Added support for a function named <dfn>_output()</dfn>, which when used in your controllers will received the final rendered output from the output class. More info in the <a href="controllers.html">Controllers</a> page.</li>
+<li>Added several new functions in the <a href="../libraries/uri.html">URI Class</a> to let you retrieve and manipulate URI segments that have been re-routed using the <a href="routing.html">URI Routing</a> feature. Previously, the URI class did not permit you to access any re-routed URI segments, but now it does.</li>
<li>Added <a href="../libraries/output.html">$this->output->set_header()</a> function, which allows you to set server headers.</li>
-<li>Added RAND() to active record orderby() function.</li>
+<li>Updated plugins, helpers, and language classes to allow your <dfn>application</dfn> folder to contain its own plugins, helpers, and language folders. Previously they were always treated as global for your entire installation. If your application folder contains any of these resources they will be used <em>instead</em> the global ones.</li>
+<li>Added <a href="../helpers/inflector_helper.html">Inflector helper</a>.</li>
+<li>Added <dfn>element()</dfn> function in the <a href="../helpers/array_helper.html">array helper</a>.</li>
+<li>Added <dfn>RAND()</dfn> to active record <dfn>orderby()</dfn> function.</li>
<li>Added <dfn>delete_cookie()</dfn> and <dfn>get_cookie()</dfn> to <a href="../helpers/cookie_helper.html">Cookie helper</a>, even though the input class has a cookie fetching function.</li>
-<li>Added German language pack.</li>
<li>Added Oracle database driver (still undergoing testing so it might have some bugs).</li>
<li>Added the ability to combine pseudo-variables and php variables in the template parser class.</li>
<li>Removed the is_numeric test from the db->escape() function.</li>
diff --git a/user_guide/general/controllers.html b/user_guide/general/controllers.html index cb38a4abc..5c51f8ff0 100644 --- a/user_guide/general/controllers.html +++ b/user_guide/general/controllers.html @@ -70,9 +70,10 @@ Controllers <li><a href="#hello">Hello World</a></li>
<li><a href="#functions">Functions</a></li>
<li><a href="#passinguri">Passing URI Segments to Your Functions</a></li>
+<li><a href="#default">Defining a Default Controller</a></li>
<li><a href="#remapping">Remapping Function Calls</a></li>
+<li><a href="#output">Controlling Output Data</a></li>
<li><a href="#private">Private Functions</a></li>
-<li><a href="#default">Defining a Default Controller</a></li>
<li><a href="#subfolders">Organizing Controllers into Sub-folders</a></li>
<li><a href="#constructors">Class Constructors</a></li>
<li><a href="#reserved">Reserved Function Names</a></li>
@@ -204,6 +205,19 @@ class Products extends Controller {<br /> passed to your function will be the re-routed ones.</p>
+<a name="default"></a>
+<h2>Defining a Default Controller</h2>
+
+<p>Code Igniter can be told to load a default controller when a URI is not present,
+as will be the case when only your site root URL is requested. To specify a default controller, open
+your <dfn>application/config/routes.php</dfn> file and set this variable:</p>
+
+<code>$route['default_controller'] = '<var>Blog</var>';</code>
+
+<p>Where <var>Blog</var> is the name of the controller class you want used. If you now load your main index.php file without
+specifying any URI segments you'll see your Hello World message by default.</p>
+
+
<a name="remapping"></a>
<h2>Remapping Function Calls</h2>
@@ -237,9 +251,33 @@ allowing you to define your own function routing rules.</p> +
+<a name="output"></a>
+<h2>Processing Output</h2>
+
+<p>Code Igniter has an output class that takes care of sending your final rendered data to the web browser automatically. More information on this can be found in the
+<a href="views.html">Views</a> and <a href="../libraries/output.html">Output class</a> pages. In some cases, however, you might want to control
+how the output gets sent to the browser, or you might want to post process the finalized data in some way. Code Igniter permits you to
+add a function named <dfn>_output()</dfn> to your controller that will receive the finalized output data.
+
+<p class="important"><strong>Important:</strong> If your controller contains a function named <kbd>_output()</kbd>, it will <strong>always</strong>
+be called by the output class instead of echoing the finalized data directly. The first parameter of the function will contain the finalized output.</p>
+
+<p>Here is an example:</p>
+
+<code>
+function _output($output)<br />
+{<br />
+ echo $output;<br />
+}</code>
+
+<p>Please note that your <dfn>_output()</dfn> function will receive the data in its finalized form - including rendered benchmark and memory usage data,
+so if you are using this feature the page execution timer might not be perfectly accurate.</p>
+
<a name="private"></a>
<h2>Private Functions</h2>
+
<p>In some cases you may want certain functions hidden from public access. To make a function private, simply add an
underscore as the name prefix and it will not be served via a URL request. For example, if you were to have a function like this:</p>
@@ -255,19 +293,6 @@ function _utility()<br /> -<a name="default"></a>
-<h2>Defining a Default Controller</h2>
-
-<p>Code Igniter can be told to load a default controller when a URI is not present,
-as will be the case when only your site root URL is requested. To specify a default controller, open
-your <dfn>application/config/routes.php</dfn> file and set this variable:</p>
-
-<code>$route['default_controller'] = '<var>Blog</var>';</code>
-
-<p>Where <var>Blog</var> is the name of the controller class you want used. If you now load your main index.php file without
-specifying any URI segments you'll see your Hello World message by default.</p>
-
-
<a name="subfolders"></a>
<h2>Organizing Your Controllers into Sub-folders</h2>
diff --git a/user_guide/general/requirements.html b/user_guide/general/requirements.html index 8a1d7c6fb..2694723bd 100644 --- a/user_guide/general/requirements.html +++ b/user_guide/general/requirements.html @@ -64,7 +64,7 @@ Server Requirements <ul>
<li><a href="http://www.php.net/">PHP</a> version 4.3.2 or newer</li>
- <li>A Database. Supported databases are MySQL, MySQLi, MS SQL, Postgre, SQLite, and ODBC</li>
+ <li>A Database. Supported databases are MySQL, MySQLi, MS SQL, Postgre, Oracle, SQLite, and ODBC</li>
</ul>
diff --git a/user_guide/libraries/calendar.html b/user_guide/libraries/calendar.html index b6830b7ed..f8cd2ff21 100644 --- a/user_guide/libraries/calendar.html +++ b/user_guide/libraries/calendar.html @@ -201,7 +201,7 @@ $prefs['template'] = '<br /><br /> <dfn>{cal_cell_blank}</dfn><var>&nbsp;</var><dfn>{/cal_cell_blank}</dfn><br />
<br />
<dfn>{cal_cell_end}</dfn><var></td></var><dfn>{/cal_cell_end}</dfn><br />
- <dfn>{cal_row_end}</dfn><var><tr></var><dfn>{/cal_row_end}</dfn><br />
+ <dfn>{cal_row_end}</dfn><var></tr></var><dfn>{/cal_row_end}</dfn><br />
<br />
<dfn>{table_close}</dfn><var></table></var><dfn>{/table_close}</dfn><br />
';<br />
|