diff options
author | Joël Cox <joel@joelcox.nl> | 2011-08-27 20:21:19 +0200 |
---|---|---|
committer | Phil Sturgeon <email@philsturgeon.co.uk> | 2011-10-27 00:44:14 +0200 |
commit | 7bd6335c77cfc5fec9e7e788d45d110c1b09ffd1 (patch) | |
tree | c4bbf6c2f08df78fb0b1be5ad8f9aa58f1915b7e /user_guide/tutorial/static_pages.html | |
parent | 5cbced2f3899726241b7a3a83e47a92fb01dbf83 (diff) |
Renamed introduction to index and small code style fixes (patch by @ericbarnes).
Diffstat (limited to 'user_guide/tutorial/static_pages.html')
-rw-r--r-- | user_guide/tutorial/static_pages.html | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/user_guide/tutorial/static_pages.html b/user_guide/tutorial/static_pages.html index bf52f4543..51a04c689 100644 --- a/user_guide/tutorial/static_pages.html +++ b/user_guide/tutorial/static_pages.html @@ -42,7 +42,7 @@ <td id="breadcrumb"> <a href="http://codeigniter.com/">CodeIgniter Home</a> › <a href="../index.html">User Guide Home</a> › -<a href="introduction.html">Tutorial</a> › +<a href="index.html">Tutorial</a> › Static pages </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> @@ -79,7 +79,7 @@ As URL schemes become more complex, this may change. But for now, this is all we class Pages extends CI_Controller { - function view($page = 'home') + public function view($page = 'home') { } @@ -134,10 +134,10 @@ If you like to be particularly un-original, try "Hello World!".</p> <p>In order to load those pages, you'll have to check whether the requested page actually exists:</p> <pre> -function view($page = 'home') +public function view($page = 'home') { - if ( ! file_exists('application/views/pages/' . $page . '.php')) + if ( ! file_exists('application/views/pages/'.$page.'.php')) { // Whoops, we don't have a page for that! show_404(); @@ -146,10 +146,10 @@ function view($page = 'home') $data['title'] = ucfirst($page); // Capitalize the first letter $this->load->view('templates/header', $data); - $this->load->view('pages/' . $page, $data); + $this->load->view('pages/'.$page, $data); $this->load->view('templates/footer', $data); - -} + +} </pre> <p>Now, when the page does exist, it is loaded, including the header and footer, and displayed to the user. If the page doesn't exist, a "404 Page not found" error is shown.</p> @@ -193,7 +193,7 @@ in the pages controller? Awesome!</p> <div id="footer"> <p> -Previous Topic: <a href="introduction.html">Introduction</a> +Previous Topic: <a href="index.html">Introduction</a> · <a href="#top">Top of Page</a> · <a href="../index.html">User Guide Home</a> · |