Skip to content

Magento : Render any XML doc on controller

here example script how to display custom xml on your custom magento plugin

 

class Module_Modulename_IndexController extends Mage_Core_Controller_Front_Action{
    public function IndexAction() {
    $this->loadLayout(false);
	$this->getResponse()->setHeader('Content-Type','text/xml');
	echo '<?xml version="1.0"?>';
	echo "<Magento>";	
		echo "<Developer>";
			echo "<Name>Ansyori</Name>";
			echo "<Email>[email protected]</Email>";
		echo "</Developer>";
		echo "<Developer>";
			echo "<Name>Ayra</Name>";
			echo "<Email>[email protected]</Email>";
		echo "</Developer>";

	echo "</Magento>";
	$this->renderLayout();
    }
}

 

Share

Be First to Comment

Leave a Reply

Your email address will not be published. Required fields are marked *