| Server IP : 103.234.187.230 / Your IP : 216.73.216.216 Web Server : Apache System : Linux lserver42043-ind.megavelocity.net 3.10.0-1160.108.1.el7.x86_64 #1 SMP Thu Jan 25 16:17:31 UTC 2024 x86_64 User : apache ( 48) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/html/adeetie_hellogtx/application/modules/sitemap/controllers/ |
Upload File : |
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Sitemap extends MY_Controller
{
public function __construct()
{
parent::__construct();
}
public function index()
{
$this->data['page']='index';
$xmlEcho = '<?xml version="1.0" encoding="UTF-8"?>';
$xmlEcho = '<?xml version="1.0" encoding="UTF-8"?>';
// $xmlEcho .= '<!-- Created with GoSavin XML Sitemap Generator 1.0 https://gosavin.com -->';
$xmlEcho .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">';
$this->data['all_pages'] = $this->db->where('status',1)->get(TBL_PAGES)->result_array();
$this->data['all_news'] =$this->db->where('status',1)->get(TBL_POSTS)->result_array();
// $this->data['all_generals'] =$this->db->where('status',1)->get(TBL_GENERAL)->result_array();
foreach ($this->data['all_pages'] as $key => $value) {
$xmlEcho .= '<url><loc>'.base_url().$value["page_slug"].'</loc><changefreq>always</changefreq><priority>1</priority></url>';
}
foreach ($this->data['all_news'] as $key => $value) {
$xmlEcho .= '<url><loc>'.base_url().$value["post_slug"].'</loc><changefreq>always</changefreq><priority>0.9</priority></url>';
}
/*foreach ($this->data['all_pages'] as $key => $value) {
$xmlEcho .= '<url><loc>https://prakasamlive.com/'.$value["page_url"].'</loc><changefreq>always</changefreq><priority>0.9</priority></url>';
}*/
$xmlEcho .= "</urlset>";
// printf($xmlEcho);
$this->data['xmltext']=$xmlEcho;
$dom = new DOMDocument;
$dom->preserveWhiteSpace = FALSE;
$dom->loadXML($xmlEcho);
$dom->formatOutput = TRUE;
$this->data['finalXML'] = $dom->saveXml();
$this->load->view('index',$this->data);
}
}