<?php

if (!defined('BASEPATH'))
    exit('No direct script access allowed');

class sitemap_site extends MX_Controller {

    public function __construct() {

        $this->load->driver('cache', $this->config->item('cache_init_config'));
        $this->load->model('sitemap/sitemap_admin_model');
    }

    public function show_sitemap() {

        $cache = $this->cache->get('sitemap_xml');
        if (empty($cache)) {
            $this->sitemap_admin_model->generate();
            $cache = $this->cache->get('sitemap_xml');
        }
        header("Content-type: text/xml; charset=utf-8");
        die($cache);
    }

}

