From 36be96982c8b8dcf19faf9de08361301499e4134 Mon Sep 17 00:00:00 2001 From: Derek Jones Date: Wed, 5 Oct 2011 15:52:41 -0500 Subject: fixed code block spacing in Loader, Output, and Pagination lib docs --- user_guide_src/source/libraries/loader.rst | 29 +++++++++++++++++++++----- user_guide_src/source/libraries/output.rst | 10 +++++++-- user_guide_src/source/libraries/pagination.rst | 10 ++++++++- 3 files changed, 41 insertions(+), 8 deletions(-) (limited to 'user_guide_src/source') diff --git a/user_guide_src/source/libraries/loader.rst b/user_guide_src/source/libraries/loader.rst index 59420e102..bbe2ed530 100644 --- a/user_guide_src/source/libraries/loader.rst +++ b/user_guide_src/source/libraries/loader.rst @@ -54,7 +54,13 @@ Setting options The second (optional) parameter allows you to optionally pass configuration setting. You will typically pass these as an array:: - $config = array (                   'mailtype' => 'html',                   'charset'  => 'utf-8,                   'priority' => '1'                ); $this->load->library('email', $config); + $config = array ( + 'mailtype' => 'html', + 'charset' => 'utf-8, + 'priority' => '1' + ); + + $this->load->library('email', $config); Config options can usually also be set via a config file. Each library is explained in detail in its own page, so please read the information @@ -74,7 +80,11 @@ $this->session. If you prefer to set your own class names you can pass its value to the third parameter:: - $this->load->library('session', '', 'my_session'); // Session class is now accessed using: $this->my_session + $this->load->library('session', '', 'my_session'); + + // Session class is now accessed using: + + $this->my_session Please take note, when multiple libraries are supplied in an array for the first parameter, this parameter is discarded. @@ -124,7 +134,9 @@ application/models/blog/queries.php you'll load it using:: If you would like your model assigned to a different object name you can specify it via the second parameter of the loading function:: - $this->load->model('Model_name', 'fubar'); $this->fubar->function(); + $this->load->model('Model_name', 'fubar'); + + $this->fubar->function(); $this->load->database('options', true/false) ============================================ @@ -197,7 +209,13 @@ named "Foo Bar". :: - /application/third_party/foo_bar config/ helpers/ language/ libraries/ models/ + /application/third_party/foo_bar + + config/ + helpers/ + language/ + libraries/ + models/ Whatever the purpose of the "Foo Bar" application package, it has its own config files, helpers, language files, libraries, and models. To use @@ -213,7 +231,8 @@ for subsequent requests for resources. As an example, the "Foo Bar" application package above has a library named Foo_bar.php. In our controller, we'd do the following:: - $this->load->add_package_path(APPPATH.'third_party/foo_bar/'); $this->load->library('foo_bar'); + $this->load->add_package_path(APPPATH.'third_party/foo_bar/'); + $this->load->library('foo_bar'); $this->load->remove_package_path() ------------------------------------ diff --git a/user_guide_src/source/libraries/output.rst b/user_guide_src/source/libraries/output.rst index 8b9b047d0..2cf7c0854 100644 --- a/user_guide_src/source/libraries/output.rst +++ b/user_guide_src/source/libraries/output.rst @@ -74,14 +74,20 @@ $this->output->set_header(); Permits you to manually set server headers, which the output class will send for you when outputting the final rendered display. Example:: - $this->output->set_header("HTTP/1.0 200 OK"); $this->output->set_header("HTTP/1.1 200 OK"); $this->output->set_header('Last-Modified: '.gmdate('D, d M Y H:i:s', $last_update).' GMT'); $this->output->set_header("Cache-Control: no-store, no-cache, must-revalidate"); $this->output->set_header("Cache-Control: post-check=0, pre-check=0"); $this->output->set_header("Pragma: no-cache"); + $this->output->set_header("HTTP/1.0 200 OK"); + $this->output->set_header("HTTP/1.1 200 OK"); + $this->output->set_header('Last-Modified: '.gmdate('D, d M Y H:i:s', $last_update).' GMT'); + $this->output->set_header("Cache-Control: no-store, no-cache, must-revalidate"); + $this->output->set_header("Cache-Control: post-check=0, pre-check=0"); + $this->output->set_header("Pragma: no-cache"); $this->output->set_status_header(code, 'text'); ================================================= Permits you to manually set a server status header. Example:: - $this->output->set_status_header('401'); // Sets the header as: Unauthorized + $this->output->set_status_header('401'); + // Sets the header as: Unauthorized `See here `_ for a full list of headers. diff --git a/user_guide_src/source/libraries/pagination.rst b/user_guide_src/source/libraries/pagination.rst index 4d8b3b5e0..f1653c913 100644 --- a/user_guide_src/source/libraries/pagination.rst +++ b/user_guide_src/source/libraries/pagination.rst @@ -17,7 +17,15 @@ Example Here is a simple example showing how to create pagination in one of your :doc:`controller <../general/controllers>` functions:: - $this->load->library('pagination'); $config['base_url'] = 'http://example.com/index.php/test/page/'; $config['total_rows'] = 200; $config['per_page'] = 20; $this->pagination->initialize($config); echo $this->pagination->create_links(); + $this->load->library('pagination'); + + $config['base_url'] = 'http://example.com/index.php/test/page/'; + $config['total_rows'] = 200; + $config['per_page'] = 20; + + $this->pagination->initialize($config); + + echo $this->pagination->create_links(); Notes ===== -- cgit v1.2.3-24-g4f1b