We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 27719
    • 6 Posts
    I am a developer who is working on a site for a client and have some questions (or more like searching for opinions) on how to handle laying out the data that I need to store for this site.

    The site that I am creating is going to be receiving data from other websites via XML feeds (most likely, this has not been set in stone yet). Either way the data is going to come in and I will need to handle this information and put it somewhere in the database. For example, if the data that is coming in is as follows (for different categories):

    <category>category1</category>
    <name>some name</name>
    <description>some description</description>
    <url>http://www.somesite.com</url>

    I am going to have to create some sort of cron job to process this data and store it somewhere. My first question is, does modx allow this type of data to be stored? I see that there are resources which look like pages of the site. I am sure that this is not where I want to store the data.

    After the data is stored, I want to be able to display this data on pages separated by categories.. I am assuming I am going to have to write some sort of plugin/snippet/etc (i am new to modx so I am still learning the different terminology..).

    If anyone can point me in the right direction I can go from there. Just wondering if anyone has had to handle something like this before. I can always store the data in a separate database if needed but I would like to be able to integrate this into modx so that I can use it on multiple sites (plugin or module maybe?)

    ~ Sean
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      You could use a cron script that gets the XML data, then loads it into the site_content table, with the categories either being the document’s parent if you want to use the tree structure as the category structure, or loading the TV tables to create a category TV for the field (more complicated, but certainly doable).

      Or you could load the data into a separate table or tables in any fashion you decide best suits the data, and use snippets or even TVs with @SELECT binding to extract the data as required.

      This is MODx! There are probably at least three other ways you could deal with the situation!
        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
        • 27719
        • 6 Posts
        I figured there were multiple solutions for this so that is why I wanted to see what other people thought.

        I think I might go the route of placing the data into separate database tables and use snippets, etc to be able to show the data how I want it.

        Putting it into the site_content table would be not be desirable because I am going to want to display multiple items of data on a single page, etc.

        Another quick question for you or someone to answer. Is it easy to create custom manager pages to manage this type of data if the data is stored in so called non-modx tables? If there is, can someone point me to some examples of this?
          • 28042 ☆ A M B ☆
          • 24,524 Posts
            Studying MODX in the desert - http://sottwell.com
            Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
            Join the Slack Community - http://modx.org
            • 27719
            • 6 Posts
            Thanks. So thats what modules are.. smiley I am learning something new everyday! So far I am really liking modx as a platform though.