[eluser]taewoo[/eluser]
Derek.. I followed your tutorial but when i try to load it in the browser, the browser asks me to download.. Is this a header issue? (By the way... browser screenshot attached)
Controller:
Code:
$data['encoding'] = 'utf-8';
$data['feed_name'] = 'RedMol.com';
$data['feed_url'] = site_url();
$data['page_description'] = 'Real Estate Cashflow Investments';
$data['page_language'] = 'en-us';
$data['creator_email'] = '[email protected]';
$data['entries'] = $this->blog_model->get_any_blogs();
header("Content-Type: application/rss+xml");
$this->load->view('feed/rss', $data);
View
Code:
<?php echo '<?xml version="1.0" encoding="utf-8"?>'; ?>
<rss version="2.0"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
xmlns:admin="http://webns.net/mvcb/"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:content="http://purl.org/rss/1.0/modules/content/">
<channel>
<title><?= $feed_name; ?></title>
<link><?= $feed_url; ?></link>
<description><?= $page_description; ?></description>
<dc:language><?= $page_language; ?></dc:language>
<dc:creator><?= $creator_email; ?></dc:creator>
<dc:rights>Copyright <?= gmdate("Y", time()); ?></dc:rights>
<?php foreach($entries as $entry){ ?>
<item>
<title><?= xml_convert($entry->title); ?></title>
<link><?= site_url('blog/user/'.$entry->user_name.'/'.date("Y/m/d/", $entry->created).url_title($entry->title) . $entry->title) ?></link>
<guid><?= site_url('blog/user/'.$entry->user_name.'/'.date("Y/m/d/", $entry->created).url_title($entry->title) . $entry->title) ?></guid>
<pubDate><?= date ('r', $entry->created);?></pubDate>
</item>
<?php } ?>
</channel>
</rss>