From c1fa07415179d63762f1a22f0f74660a8034707f Mon Sep 17 00:00:00 2001
From: admin
Date: Thu, 21 Sep 2006 23:50:23 +0000
Subject:
---
system/libraries/Controller.php | 2 +-
system/libraries/Output.php | 22 ++++++++++-----
system/libraries/URI.php | 2 +-
user_guide/general/changelog.html | 14 +++++-----
user_guide/general/controllers.html | 53 ++++++++++++++++++++++++++----------
user_guide/general/requirements.html | 2 +-
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
Version 1.4.1
-Release Date: September 25, 2006
+Release Date: September 21, 2006
- Added a new feature that passes URI segments directly to your function calls as parameters. See the Controllers page for more info.
-- Added several new functions in the URI Class 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 URI Routing feature. Now it does.
-- 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.
-- Added Inflector helper.
-- Added element() function in the array helper.
+- Added support for a function named _output(), which when used in your controllers will received the final rendered output from the output class. More info in the Controllers page.
+- Added several new functions in the URI Class to let you retrieve and manipulate URI segments that have been re-routed using the URI Routing feature. Previously, the URI class did not permit you to access any re-routed URI segments, but now it does.
- Added $this->output->set_header() function, which allows you to set server headers.
-- Added RAND() to active record orderby() function.
+- Updated plugins, helpers, and language classes to allow your application 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 instead the global ones.
+- Added Inflector helper.
+- Added element() function in the array helper.
+- Added RAND() to active record orderby() function.
- Added delete_cookie() and get_cookie() to Cookie helper, even though the input class has a cookie fetching function.
-- Added German language pack.
- Added Oracle database driver (still undergoing testing so it might have some bugs).
- Added the ability to combine pseudo-variables and php variables in the template parser class.
- Removed the is_numeric test from the db->escape() function.
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
- Hello World
- Functions
- Passing URI Segments to Your Functions
+- Defining a Default Controller
- Remapping Function Calls
+- Controlling Output Data
- Private Functions
-- Defining a Default Controller
- Organizing Controllers into Sub-folders
- Class Constructors
- Reserved Function Names
@@ -204,6 +205,19 @@ class Products extends Controller {
passed to your function will be the re-routed ones.
+
+Defining a Default Controller
+
+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 application/config/routes.php file and set this variable:
+
+$route['default_controller'] = 'Blog';
+
+Where Blog 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.
+
+
Remapping Function Calls
@@ -237,9 +251,33 @@ allowing you to define your own function routing rules.
+
+
+Processing Output
+
+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
+Views and Output class 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 _output() to your controller that will receive the finalized output data.
+
+
Important: If your controller contains a function named _output(), it will always
+be called by the output class instead of echoing the finalized data directly. The first parameter of the function will contain the finalized output.
+
+Here is an example:
+
+
+function _output($output)
+{
+ echo $output;
+}
+
+Please note that your _output() 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.
+
Private Functions
+
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:
@@ -255,19 +293,6 @@ function _utility()
-
-Defining a Default Controller
-
-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 application/config/routes.php file and set this variable:
-
-$route['default_controller'] = 'Blog';
-
-Where Blog 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.
-
-
Organizing Your Controllers into Sub-folders
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
- PHP version 4.3.2 or newer
- - A Database. Supported databases are MySQL, MySQLi, MS SQL, Postgre, SQLite, and ODBC
+ - A Database. Supported databases are MySQL, MySQLi, MS SQL, Postgre, Oracle, SQLite, and ODBC
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'] = '
{cal_cell_blank} {/cal_cell_blank}
{cal_cell_end}</td>{/cal_cell_end}
- {cal_row_end}<tr>{/cal_row_end}
+ {cal_row_end}</tr>{/cal_row_end}
{table_close}</table>{/table_close}
';
--
cgit v1.2.3-24-g4f1b