Skip to content

Commit

Permalink
Give a more complete example for xml view generation (#7933)
Browse files Browse the repository at this point in the history
Fixes #7932
  • Loading branch information
markstory authored Oct 22, 2024
1 parent 8af2578 commit ead66f6
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions en/views/json-and-xml-views.rst
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,13 @@ An example of using ``XmlView`` would be to generate a `sitemap.xml
change ``rootNode`` and set attributes. Attributes are defined using the ``@``
prefix::

use Cake\View\XmlView;

public function viewClasses(): array
{
return [XmlView::class];
}

public function sitemap()
{
$pages = $this->Pages->find()->all();
Expand Down

0 comments on commit ead66f6

Please sign in to comment.