1. Attila Fulop
  2. konekt-cmf

Overview

HTTPS SSH

Konekt Content Management Framework

Konekt CMF is mostly an extension to the Konekt Framework, however currently only contains the Seo package that can entirely be used standalone.

Using the XML Sitemap generator

If you're using the Konekt Framework just add the module to app.yml:

core:
   modules:
      Konekt_Framework_Core:
      Konekt_Cmf_Seo:

Otherwise put the entire directory somewhere in your path and fire up your Autoloader to load the classes.

Example

<?php

use Konekt\Cmf\Seo\Model\Sitemap\XmlSitemap,
    Konekt\Cmf\Seo\Model\Sitemap\XmlSitemapIndex,
    Konekt\Cmf\Seo\Model\Sitemap\Url,
    Konekt\Cmf\Seo\Model\Sitemap\ChangeFrequency;

//////////////////////
// Generate Sitemap //
//////////////////////

$sitemap = new XmlSitemap('http://www.example.com/', '/sitemap.xml');

$url = new Url('Televizoare_&_Home_cinema/Televizoare/LED_TV');
$url->setLastmod('2012-04-16') //Optional
   ->setChangefrequency(new ChangeFrequency(ChangeFrequency::Weekly)); //Optional
$sitemap->addUrl($url);

$url2 = new Url('/Televizoare_&_Home_cinema/Televizoare');
$url2->setLastmod(time()) //Optional
   ->setPriority(7); //Optional
$sitemap->addUrl($url);

$sitemap->addUrl(new Url('/Computere/Laptop-uri/Notebook_-_Laptop/Apple/Notebook_MacBook_Pro_13inch_Dual-Core_i5_2.5_GHz'));

header('Content-type: application/xml');
echo $sitemap->render();

////////////////////////////
// Generate Sitemap Index //
////////////////////////////

$smi = new XmlSitemapIndex();
$sm = new XmlSitemap('http://www.example.com/', '/sitemap.xml');
$sm->setLastmod(time()); //Optional you can omit it
$smi->addSitemap($sm);

header('Content-type: application/xml');
echo $smi->render();

The example output of generated Sitemap:

<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
   <url>
      <loc>http://www.example.com/Televizoare_&amp;_Home_cinema/Televizoare/LED_TV</loc>
      <lastmod>2012-04-16</lastmod>
      <changefreq>weekly</changefreq>
   </url>
   <url>
      <loc>http://www.example.com/Computere/Laptop-uri/Notebook_-_Laptop/Apple/Notebook_MacBook_Pro_13inch_Dual-Core_i5_2.5_GHz</loc>
   </url>
</urlset>

The example output of generated Sitemap Index:

<?xml version="1.0" encoding="UTF-8"?>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
   <sitemap>
      <loc>http://www.example.com/sitemap.xml</loc>
      <lastmod>2013-04-17</lastmod>
   </sitemap>
</sitemapindex>

License

(The MIT License)

Copyright (c) 2011-2013 Attila Fulop;

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.