自定义Component
class ApiComponent extends Component {
public $controller;
public function __construct(ComponentCollection $collection, $settings = array()) {
$settings = array_merge($this->settings, ( array ) $settings);
$this->controller = $collection->getController();
parent::__construct($collection, $settings);
}
public function initialize(Controller $controller) {
$this->controller = $controller;
}
public function startup(Controller $controller) {
$this->controller = $controller;
}
}
controller中根据不同情况显示view
class ProdController extends AppController {
function detail() {
return $this->setAction('detail_coupon', $param);
}
function detail_coupon() {
$this->render();
}
}