Initially, we will start with a simple controller example that opens a home page with the navigation option back and forth to another page B, and similarly to the home page. We will do so while rendering some controller calculated data at the view.
This example doesn't use the database. This example will be built from the following CI framework component configuration, controller, and view files.
Let us define the default controller filename as controller/home_page.php
and the home page view as views/home_page_view.php
.
Let us assume the URI to the project root is http://mydomain.com/myproject
.
The controller file /home_page.php
will prepare some data to be shown in the view and will let the user navigate to page B and similarly back to the home page.
The helpers used are provided with the sample source code provided with this book.
The following is the code:
<?php class Home_page extends CI_Controller { function __construct() { ...