I have my RSS feed from controller returned /displayed on frontend using echo , how do I replace echo any alternate method availabale?
MEQP1.Security.LanguageConstruct.DirectOutput
public function execute()
{
$shopUri = $this->_storeManager->getStore()->getBaseUrl();
$posts = $this->collectionFactory->create()->addFieldToFilter('is_active', 1);
$this->output .= '<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
<channel>
<title><![CDATA['.$this->myHelper->getFinalIdentifier().']]></title>
<description>Some Title</description>
<link>'.$shopUri.'</link>
<webMaster>'.$this->myHelper->getStoreEmail().'</webMaster>
<image>
<title><![CDATA['.$this->myHelper->getStorename().']]></title>
<link>'.$shopUri.'</link>
</image>';
if (isset($posts) && $posts) {
foreach ($posts as $post) {
$url = $post->getIdentifier();
$blog_link = $shopUri.$this->myHelper->getDetailIdentifier($url);
$this->output .= '
<item>
<title><![CDATA['.$post->getTitle().']]></title>
<pubDate>'.date('r', strtotime($post->getPublishDate())).'</pubDate>
<description>';
if ($post->getImage()) {
$this->output .= '<![CDATA[<img src="'.$this->myHelper->resizeImage($post->getImage(), 100, 75).'" title="'.$post->getTitle().'" alt="'.$post->getTitle().'" width="120"/>]]>';
}
$this->output .= '<![CDATA['.$post->getShortSummary().']]></description>';
$this->output .= '
<link>'.str_replace('&', '&', htmlspecialchars($blog_link)).'</link>
<guid isPermaLink="true">'.str_replace('&', '&', htmlspecialchars($blog_link)).'</guid>
</item>';
}
}
$this->output .= '
</channel>
</rss>';
echo $this->output;
}