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 3 – retrieving data from Facebook

In this example, we will use the CI built-in model to retrieve data from Facebook.

The example displays a Facebook user name and picture and displays the user's Facebook friends.

This example uses Facebook PHP SDK as a CI library. It can be downloaded from https://github.com/facebook/php-sdk. For more information, refer to Chapter 4, Libraries.

This example will be constructed from the following controllers, model, and view:

  • application/controllers/fbpage.php: This controller loads the model fbmodel
  • $this->load->model('fbmodel'): This controller renders the view fbview, which displays the user's Facebook picture and name, and table, which contains the user's friends' names and links to their profiles
  • application/models/fbmodel.php ...

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