O'Reilly logo

Programming with CodeIgniter MVC by Yehuda Zadik, Eli Orr

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Example 1 – default homepage controller

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

The controller file /home_page.php will prepare some data to be shown in the view and will let the ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required