File tree Expand file tree Collapse file tree 2 files changed +19
-3
lines changed Expand file tree Collapse file tree 2 files changed +19
-3
lines changed Original file line number Diff line number Diff line change @@ -374,6 +374,22 @@ view logic::
374374It is important to remember that match-all views are applied only *after *
375375content-type negotiation is attempted.
376376
377+ Using AjaxView
378+ ==============
379+
380+ In applications that use hypermedia or AJAX clients, you often need to render
381+ view contents without the wrapping layout. You can use the ``AjaxView `` that
382+ is bundled with the application skeleton::
383+
384+ // In a controller action, or in beforeRender.
385+ if ($this->request->is('ajax')) {
386+ $this->viewBuilder()->setClassName('Ajax');
387+ }
388+
389+ ``AjaxView `` will respond as ``text/html `` and use the ``ajax `` layout.
390+ Generally this layout is minimal or contains client specific markup. This
391+ replaces usage of ``RequestHandlerComponent `` automatically using the
392+ ``AjaxView `` in 4.x.
377393
378394Redirecting to Other Pages
379395==========================
Original file line number Diff line number Diff line change @@ -117,9 +117,9 @@ Another example, using if/elseif/else. Notice the colons:
117117 <h3 >Hi unknown user</h3 >
118118 <?php endif; ?>
119119
120- If you'd prefer using a templating language like
121- `Twig <https://twig.symfony.com >`_, a subclass of View will bridge your
122- templating language and CakePHP.
120+ If you'd prefer to use a templating language like
121+ `Twig <https://twig.symfony.com >`_, checkout the ` CakePHP Twig Plugin
122+ <https://github.com/cakephp/twig-view> `__
123123
124124Template files are stored in **templates/ **, in a folder named after the
125125controller that uses the files, and named after the action it corresponds to.
You can’t perform that action at this time.
0 commit comments