-------------------------------- Title -------------------------------- Importing Entries from WordPress -------------------------------- Description -------------------------------- This is a proof of concept for importing XML into Symphony using an event and a front-end form that is populated with data from a WordPress Export File. It is a continuation of the tutorials on [Importing XML in Symphony](http://designprojectx.com/tutorials/importing-xml-in-symphony/) and [Symphony Events](http://designprojectx.com/tutorials/symphony-events/). -------------------------------- Body -------------------------------- Now that we know how to import XML into Symphony, and we have created an event to save data to the database through a front-end form, we can use that form to import data from WordPress by populating the fields with the appropriate data. If we can do this from WordPress, we can certainly do the same thing from Symphony. The tricky thing with WordPress is that it allows data that is not valid XML, whereas Symphony requires valid XML for all data entry. So, for WordPress entries the process may not be seamless in many cases, since validation errors may occur. A Symphony XML import should cause no problems at all. At any rate, here’s the template that makes this work. You can see this in action by navigating to the [Import demo page](/import/), where I’ve added “Next” and “Previous” links and a list of available entries from the XML file, which will display the selected entry. A class of “current” is applied to the list item that matches the entry node position indicated by the `$a` parameter, specified as a URL parameter in the Import page configuration. 1

Import a WordPress Entry

Import Fields

,
The Section and Category fields pull entry titles and IDs from their respective data sources. I have hard-coded the preferred selections in the template, so that the Journal section and the Technology category are selected by default. It is also possible to configure the template to match the category specified in the WordPress Export File, but in this case, I have chosen to limit the category to a single option for my entries. Multiple categories are handled by the Tags field, where a named template is used to populate the Tags field with a comma separated list of tags. I have commented out the submit button and removed the Save Entry event from the page to avoid comment spamming. This allows anyone to view the import demo without the worry that my Entries section will start filling up with garbage. -------------------------------- Date -------------------------------- 25 May 2009 11:36pm -------------------------------- Section -------------------------------- Tutorials -------------------------------- Category -------------------------------- Technology -------------------------------- Tags -------------------------------- symphony cms, xml, xslt