Skip to content

Commit

Permalink
Merge pull request bcit-ci#546 from purwandi/develop
Browse files Browse the repository at this point in the history
Fix CodeIgniter URLs, Controller and Views on User Guide
  • Loading branch information
Phil Sturgeon committed Oct 7, 2011
2 parents a3e952e + 5ebf9d1 commit 0252fc7
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 25 deletions.
9 changes: 4 additions & 5 deletions user_guide_src/source/general/controllers.rst
Expand Up @@ -10,8 +10,8 @@ HTTP requests should be handled.
What is a Controller?
=====================

A Controller is simply a class file that is named in a way that can be
associated with a URI.
**A Controller is simply a class file that is named in a way that can be
associated with a URI.**

Consider this URI::

Expand Down Expand Up @@ -136,7 +136,7 @@ Defining a Default Controller

CodeIgniter 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
To specify a default controller, open your **application/config/routes.php**
file and set this variable::

$route['default_controller'] = 'Blog';
Expand Down Expand Up @@ -199,8 +199,7 @@ Processing Output

CodeIgniter 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 :doc::doc:`Views <views>` and `Output
class <../libraries/output>` pages. In some cases, however, you
can be found in the :doc:`Views <views>` and :doc:`Output class <../libraries/output>` pages. In some cases, however, you
might want to post-process the finalized data in some way and send it to
the browser yourself. CodeIgniter permits you to add a function named
_output() to your controller that will receive the finalized output
Expand Down
11 changes: 5 additions & 6 deletions user_guide_src/source/general/urls.rst
Expand Up @@ -28,8 +28,7 @@ approach, usually represent::
#. The third, and any additional segments, represent the ID and any
variables that will be passed to the controller.

The :doc::doc:`URI Class <../libraries/uri>` and the `URL
Helper <../helpers/url_helper>` contain functions that make it
The :doc:`URI Class <../libraries/uri>` and the :doc:`URL Helper <../helpers/url_helper>` contain functions that make it
easy to work with your URI data. In addition, your URLs can be remapped
using the :doc:`URI Routing <routing>` feature for more flexibility.

Expand All @@ -56,13 +55,13 @@ images, and robots.txt is treated as a request for your index.php file.
Adding a URL Suffix
===================

In your config/config.php file you can specify a suffix that will be
In your **config/config.php** file you can specify a suffix that will be
added to all URLs generated by CodeIgniter. For example, if a URL is
this::

example.com/index.php/products/view/shoes

You can optionally add a suffix, like .html, making the page appear to
You can optionally add a suffix, like **.html,** making the page appear to
be of a certain type::

example.com/index.php/products/view/shoes.html
Expand All @@ -75,7 +74,7 @@ In some cases you might prefer to use query strings URLs::
index.php?c=products&m=view&id=345

CodeIgniter optionally supports this capability, which can be enabled in
your application/config.php file. If you open your config file you'll
your **application/config.php** file. If you open your config file you'll
see these items::

$config['enable_query_strings'] = FALSE;
Expand All @@ -88,7 +87,7 @@ active. Your controllers and functions will then be accessible using the

index.php?c=controller&m=method

..note:: If you are using query strings you will have to build
.. note:: If you are using query strings you will have to build
your own URLs, rather than utilizing the URL helpers (and other helpers
that generate URLs, like some of the form helpers) as these are designed
to work with segment based URLs.
28 changes: 14 additions & 14 deletions user_guide_src/source/general/views.rst
Expand Up @@ -24,7 +24,7 @@ in it::

<html>
<head>
<title>My Blog</title>
<title>My Blog</title>
</head>
<body>
<h1>Welcome to my Blog!</h1>
Expand Down Expand Up @@ -141,7 +141,7 @@ to the array keys in your data::

<html>
<head>
<title><?php echo $title;?></title>
<title><?php echo $title;?></title>
</head>
<body>
<h1><?php echo $heading;?></h1>
Expand Down Expand Up @@ -180,27 +180,27 @@ Now open your view file and create a loop::

<html>
<head>
<title><?php echo $title;?></title>
<title><?php echo $title;?></title>
</head>
<body>
<h1><?php echo $heading;?></h1>

<h3>My Todo List</h3>

<ul>
<?php foreach ($todo_list as $item):?>

<li><?php echo $item;?></li>
<h1><?php echo $heading;?></h1>
<h3>My Todo List</h3>

<?php endforeach;?>
</ul>
<ul>
<?php foreach ($todo_list as $item):?>
<li><?php echo $item;?></li>
<?php endforeach;?>
</ul>

</body>
</html>

.. note:: You'll notice that in the example above we are using PHP's
alternative syntax. If you are not familiar with it you can read about
it `here </general/alternative_php>`.
it :doc:`here </general/alternative_php>`.

Returning views as data
=======================
Expand Down

0 comments on commit 0252fc7

Please sign in to comment.