PHP code example of ciricihq / cake-sitemap

1. Go to this page and download the library: Download ciricihq/cake-sitemap library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

ciricihq / cake-sitemap example snippets


Plugin::load('Sitemap', ['bootstrap' => false, 'routes' => true]);

Configure::write('Sitemap.tables', [
	'Pages',
	'Sites',
	'Camps',
]);

$this->addBehavior('Sitemap.Sitemap');

'cacheConfigKey' => 'default',
'lastmod' => 'modified',
'changefreq' => 'daily',
'priority' => '0.9',
'conditions' => [],
'order' => [],
'fields' => [],
'implementedMethods' => [
	'getUrl' => 'returnUrlForEntity',
],
'implementedFinders' => [
	'forSitemap' => 'findSitemapRecords',
],

$this->addBehavior('Sitemap.Sitemap', ['changefreq' => 'weekly']);

public function getUrl(\Cake\ORM\Entity $entity) {
	return \Cake\Routing\Router::url(
		[
			'prefix' => false,
			'plugin' => false,
			'controller' => $this->registryAlias(),
			'action' => 'display',
			$entity->display_id,
		],
		true
	);
}