From 02af4350ad36fca8d86d928480e92dd155c3e243 Mon Sep 17 00:00:00 2001 From: Arhell Date: Wed, 23 Oct 2024 00:18:46 +0300 Subject: [PATCH] Give a more complete example for xml view generation (es, fr, ja) --- es/views/json-and-xml-views.rst | 7 +++++++ fr/views/json-and-xml-views.rst | 7 +++++++ ja/views/json-and-xml-views.rst | 7 +++++++ 3 files changed, 21 insertions(+) diff --git a/es/views/json-and-xml-views.rst b/es/views/json-and-xml-views.rst index eef756f76d..6d5e9ad52c 100644 --- a/es/views/json-and-xml-views.rst +++ b/es/views/json-and-xml-views.rst @@ -150,6 +150,13 @@ Un ejemplo de uso de ``XmlView`` sería generar un `sitemap.xml que cambie ``rootNode`` y establezca atributos. Los atributos se definen mediante el prefijo ``@``:: + use Cake\View\XmlView; + + public function viewClasses(): array + { + return [XmlView::class]; + } + public function sitemap() { $pages = $this->Pages->find()->all(); diff --git a/fr/views/json-and-xml-views.rst b/fr/views/json-and-xml-views.rst index d8bc35c525..dab41a72b2 100644 --- a/fr/views/json-and-xml-views.rst +++ b/fr/views/json-and-xml-views.rst @@ -153,6 +153,13 @@ Comme exemple d'utilisation de ``XmlView``, on peut imaginer la génération d'u nécessite de changer ``_rootNode`` et de définir des attributs. Les attributs sont définis en utilisant le préfixe ``@``:: + use Cake\View\XmlView; + + public function viewClasses(): array + { + return [XmlView::class]; + } + public function sitemap() { $pages = $this->Pages->find()->all(); diff --git a/ja/views/json-and-xml-views.rst b/ja/views/json-and-xml-views.rst index 2c5bcbbddf..36e8e855e9 100644 --- a/ja/views/json-and-xml-views.rst +++ b/ja/views/json-and-xml-views.rst @@ -142,6 +142,13 @@ XmlView クラスは、XML の生成に使用するオプション(例: ``tags このドキュメントタイプでは ``rootNode`` を変更し属性を設定する必要があります。 属性は ``@`` プレフィックスを使用して定義されます。 :: + use Cake\View\XmlView; + + public function viewClasses(): array + { + return [XmlView::class]; + } + public function sitemap() { $pages = $this->Pages->find()->all();