mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Update API docs
View switching only happens for known mime types. Refs #2565
This commit is contained in:
parent
4c01ba7224
commit
ab09229d40
2 changed files with 8 additions and 3 deletions
|
@ -159,7 +159,10 @@ class RequestHandlerComponent extends Component {
|
|||
* 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 @@ class Router {
|
|||
* Instructs the router to parse out file extensions from the URL. For example,
|
||||
* http://example.com/posts.rss 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;
|
||||
|
|
Loading…
Reference in a new issue