How-to create a simple Drupal XML node type
Tags:
You want to use Flash or other dynamic elements in your Drupal site, you want these elements to reference dynamic XML (or minimally XML you can quickly change). You want a simple solution not overkill. You can code PHP and provide any of the data from your site but need to display an XML file.
Following are quick and dirty instructions to provide XML directly or generated by PHP in the body of a node. We do this by creating a new Content Type for XML, simplifying the templates, using PHP to create XML content and then the Path module to display the .xml extension to the node.
Call it what you will. Try This:
- create a new content type named “xmltype”
- override 2x .tpl.php pages (to just "print $content;")
- page-node-4.tpl.php (needs to be done for each specific XML node)
- node-xmltype.tpl.php
- duplicate page.tpl.php to page-node-edit.tpl.php
- enable Path module
- name the node nodename.xml
- use PHP input type to create XML dynamically or display specifically what XML you want
Original Article: