-
Book Overview & Buying
-
Table Of Contents
CakePHP 2 Application Cookbook - Third Edition
By :
When you first build an application, you'll most likely imagine how the user will interact with it and how it will be designed and structured for your content and features. However, there also comes a time when you'll want to expose certain functionality of your website as web services.
CakePHP comes well-prepared for this, so in this recipe, we'll look at how you can easily create a data-focused controller to serve certain functionality of your application via a service.
For this recipe, we'll start with a basic controller to serve as our endpoint. So, create a file named ApiController.php in app/Controller/ with the following content:
<?php
App::uses('AppController', 'Controller');
class ApiController extends AppController {
}Perform the following steps:
Add the following line to your routes.php file in app/Config/:
Router::connect('/api/:object/:command', array(
'controller' => 'api',
'action' => 'delegate'
), array(
'pass...
Change the font size
Change margin width
Change background colour