Skip to content
Browse files

Update API docs

View switching only happens for known mime types.
Refs #2565
  • Loading branch information...
markstory committed Feb 11, 2012
1 parent 4c01ba7 commit ab09229d405939234c3439ec8151aee145325183
Showing with 8 additions and 3 deletions.
  1. +4 −1 lib/Cake/Controller/Component/RequestHandlerComponent.php
  2. +4 −2 lib/Cake/Routing/Router.php
@@ -159,7 +159,10 @@ protected function _setExtension() {
* switched based on the parsed extension or Accept-Type header. For example, if `controller/action.xml`
* is requested, the view path becomes `app/View/Controller/xml/action.ctp`. Also if
* `controller/action` is requested with `Accept-Type: application/xml` in the headers
* the view path will become `app/View/Controller/xml/action.ctp`.
* the view path will become `app/View/Controller/xml/action.ctp`. Layout and template
* types will only switch to mime-types recognized by CakeResponse. If you need to declare
* additional mime-types, you can do so using CakeResponse::type() in your controllers beforeFilter()
* method.
* - If a helper with the same name as the extension exists, it is added to the controller.
* - If the extension is of a type that RequestHandler understands, it will set that
* Content-type in the response header.
@@ -1030,15 +1030,17 @@ public static function stripPlugin($base, $plugin = null) {
* Instructs the router to parse out file extensions from the URL. For example,
* would yield an file extension of "rss".
* The file extension itself is made available in the controller as
* $this->params['url']['ext'], and is used by the RequestHandler component to
* `$this->params['ext']`, and is used by the RequestHandler component to
* automatically switch to alternate layouts and templates, and load helpers
* corresponding to the given content, i.e. RssHelper.
* corresponding to the given content, i.e. RssHelper. Switching layouts and helpers
* requires that the chosen extension has a defined mime type in `CakeResponse`
* A list of valid extension can be passed to this method, i.e. Router::parseExtensions('rss', 'xml');
* If no parameters are given, anything after the first . (dot) after the last / in the URL will be
* parsed, excluding querystring parameters (i.e. ?q=...).
* @return void
* @see RequestHandler::startup()
public static function parseExtensions() {
self::$_parseExtensions = true;

0 comments on commit ab09229

Please sign in to comment.
You can’t perform that action at this time.