Hi All
I’m building a XML sitemap myself. I know there are plugins available, but I need to learn about XML and CakePHP for later in my project so thought this could be a good training exercise.
I have a problem. If I use the following in my controller the Browser recognises the file as an XML file however if does not use my sitemap.ctp file and outputs all of the data.
$this->RequestHandler->renderAs($this, 'xml');
But if I use the following it does output the data exactly, but my browser does not think the file is an XML file.
$this->RequestHandler->respondAs('xml', [
'charset' => 'UTF-8'
]);
I am using a sitemap specific layout;
$this->viewBuilder()->layout(‘sitemap’);
Where am I going wrong?
Thanks in advance.
Andy