<?php

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

class example_sitemap_api extends sitemap {

    public function __construct() {

        $this->module_name = 'example';
        $this->get_static();
        $this->get_data();
    }

    protected function get_data() {

        $CI = & get_instance();
        $query = $CI->db->
                        select('id_cat')->
                        order_by('id_cat', 'DESC')->
                        get('cats')->result_array();

        foreach ($query as $k => $v) {
            $this->map[] = new sitemap_item(base_url('bengal_cat_videoalbom/' . $v['id_cat']), date("Y-m-d"), $this->changefreq, $this->priority);
            $this->map[] = new sitemap_item(base_url('british_cat_videoalbom/' . $v['id_cat'], date("Y-m-d")), date("Y-m-d"), $this->changefreq, $this->priority);
        }
    }

    protected function get_static() {

        $CI = & get_instance();
        $static_val = $CI->db->
                        select('changefreq,priority')->
                        where('module_name', $this->module_name)->
                        get('sitemap_config')->row_array();

        if (!empty($static_val['changefreq'])) {
            $this->changefreq = $static_val['changefreq'];
        }

        if (!empty($static_val['priority'])) {
            $this->priority = $static_val['priority'];
        }
    }

}