Steps to Generate XML file using CakePHP: Step-1 Enable to parse xml extension in config route.php file. Router::parseExtensions('xml'); Step-2 Add Request Handler Component to the Controller var $components = array(‘RequestHandler’); Step-3 Add controller Action For XML Generation in Post Controller function generateXMLFile() { if ($this->RequestHandler->isXml()) { // check request type $this->layout = 'empty'; // create an empty layout in app/views/layouts/empty.ctp } } Add header code in empty layout <?php header('Content-type: text/xml');?> <?php echo $this->Xml->header(); ?> <?php echo $content_for_layout; ?> Step-4 Set up View To generate XML Create xml folder inside Posts vi...
Coding Cheatsheets - Learn web development code and tutorials for Software developers which will helps you in project. Get help on JavaScript, PHP, XML, and more.