O'Reilly logo

Yii Rapid Application Development Hotshot by James R. Hamilton III, Lauren J. O'Meara

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

Google Me – The Yii Way

This task is about dividing the functionality implemented into the previous task into a view and a controller.

Engage Thrusters

  1. Move the PHP code from the beginning of protected/views/gpf/index.php, going down to <h1>Google+ Comic Book News Feed</h1> (leave the breadcrumbs where they are) into the indexAction() function in protected/controllers/GpfController.php. Move the line initializing $authUrl to the top of the function. Then make some changes in the loop to store a list of entities to pass to the view, as follows (remember to replace CLIENT_ID, CLIENT_SECRET, and DEVELOPER_KEY with the correct values):
    <?php Yii::import('application.vendors.*'); require_once 'google-api-php-client/src/apiClient.php'; require_once ...

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