Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<?php
namespace App\Controller;
use App\Controller\AppController;
use Cake\Routing\Router;
use Cake\ORM\TableRegistry;
class SitemapsController extends AppController
{
public function index() {
$this->viewBuilder()->setLayout('sitemap');
$this->RequestHandler->respondAs('xml');
$url = Router::url('/', true);
$this->Items = TableRegistry::get('Items');
$items = $this->Items->find()->select('item_id')->all();
$this->set('url', $url);
$this->set('items', $items);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.