= Data Sources = == Using XML data sources for Mailing Lists == To create new mailing list from a data source you need to setup a new XML data source in the Campaigns/Data Sources menu and click Add new. Enter the name for the Data Source which will become the name of the Mailing List as well and the URL address of the XML source. Select type XML and Target Mailing List and click Save. The new datasource will be added to the list. [[Image(http://www.mailkit.info/images/stories/doc_images/ds_edit.gif)]] ''Syndicate users are also presented with Auto-update checkbox. When checked, the XML Data Source will be automatically imported and the Mailing List auto-updated prior to every campaign delivery.'' To retrieve the contents you have to assign the XML child to each contact detail field. Click on the Data Source you have added and click on the Display XML button to make the assignments. When you have finished the assignments, click the save button and use the import button to proceed with actual import. At that moment the new Mailing List will be created and the data from the XML will be imported according to your assignments. [[Image(http://www.mailkit.info/images/stories/doc_images/ds_structure.gif)]] == Using XML & RSS data sources in your templates == Setup of the XML & RSS data sources to use in templates is similar to the one for mailing lists, but there is no assignment to be done. The values are addressed by the node names in the template making it easy to setup any type of XML or RSS feed. {{{ #!text/html [% FOREACH data.DS_RSS_EXAMPLE -%]
[% TITLE -%]
[% TITLE -%][% DESCRIPTION -%]
[% END -%] }}} The above example template code is using an RSS data source named EXAMPLE. The FOREACH statement creates a loop to parse the data source and find each record. Each of the standard RSS tags are easily addressed and inserted into the HTML code resulting in the output of the data in the template. Please see the [wiki:MailTemplates Mail Templates] page for more information on using template directives.