I am trying to create sitemap in my codeigniter app following this answer
Here is my controller method:
public function siteMap() {
$this->load->helper('url');
$urls = array("test");
$data['urls'] = $urls;
$data['frontend'] = $this->getFronendItems();
$this->load->template('front/site_map.php', $data);
}
And my view:
<?php header('Content-type: text/xml'); ?>
<?= '<?xml version="1.0" encoding="UTF-8" ?>' ?>
<url>
<loc><?= base_url() ?></loc>
<priority>1.0</priority>
</url>
<?php foreach($urls as $url) { ?>
<url>
<loc><?= base_url() . $url ?></loc>
<priority>0.5</priority>
</url>
<?php } ?>
This raises the following error:
This page contains the following errors:
error on line 41 at column 8: Opening and ending tag mismatch: link line 0 and head
Tried to remove the header and the url is just echoing as a string on the screen. What am I doing wrong ?