output->enable_profiler(TRUE); $this->load->model('Area_model'); $this->load->model('InfoStructures_model'); $this->load->model('Information_model'); $this->load->model('Coupon_model'); } public function index() { $this->permission->is_admin(); $this->create($this->config->item('site_url')); } public function save($site_code) { $site_array = $this->config->item('site'); $site = $site_array[$site_code]; $site_url = $site['site_url']; $sitemap_name = $site['site_sitemap']; if (!empty($sitemap_name)) { $this->create($site_url, $sitemap_name); } else { echo 'no set sitemap name'; } } public function create($site_url, $site_sitemap = false) { @set_time_limit(0); $data = array(); $sitemap_string = ' '; $data['lastEditList'] = $this->Information_model->get_last_edit_list(false); foreach ($data['lastEditList'] as $item) { if ($item->ic_status == 1 && $item->ic_url != '' && strlen($item->ic_content)>50 ) { $sitemap_string.='' . $site_url . $item->ic_url . '' . date('c', strtotime($item->ic_datetime)) . ''; } } $sitemap_string.=' '; if ($site_sitemap) { $this->load->helper('file'); if (!write_file($site_sitemap, $sitemap_string)) { echo 'Unable to write the file'; } else { echo 'File written!'; } } else { $this->load->helper('download'); force_download('sitemap.xml', $sitemap_string); } //echo $sitemap_string;die(); // $this->load->view('bootstrap/header', $data); //$this->load->view('bootstrap/sitemap'); // $this->load->view('bootstrap/footer'); } }