We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 22980
    • 84 Posts
    Hi Everyone

    Over the past few weeks I’ve been building a MODx plugin designed to make it easy to implement additional custom database tables directly and elegantly in to the website and the MODx backend. Datafrolic makes it easy to associate data (custom tables) with a specific Resource, in either one-to-many or many-to-many relationship. Its designed to make it easy for the a web layperson to edit the data (CRUDding entries,) as well as equally easy for the developer to set up tables for a resource. To my knowledge nothing similar existing yet, so this should be pretty exciting!

    The way it works is based (intially) off of the well known Managermanager plugin. There is one section for config, which is run on the ’OnDocFormRender’ event and which describes tables and assigns them to a specific resource or template. This then creates a tab on the resource page when the resource is edited. For example, I have a page ’Articles’, and a custom table of articles in a One to Many relationship. The configuration code is a simple as this (it becomes a little more complex with a many-to-many relationship):

    		$articles = new df_table_info('news', '', array('date' => 'Article Date', 'title' => 'Title', 'status' => 'Active?') );
    		$articles->setPrimaryKey('id');
    		df_createO2MTab('Articles', 'Article', $articles, $current_doc_id,'','',$news); 


    Really quick: df_table_info describes a table, the arguments for construction are the table name, foreign keys (any connected tables), and summary fields (fields which will be displayed in the table of data in the tab.)


    Finally, I’m posting here to try and get a feel for what you guys think of this. My hope is that it will be extremely useful and fill a much-needed void in MODx capability. This was written for the latest Evolution release, I don’t know what would be involved in Revo compatibility. Its maybe about 80% done with a week or so left, the majority of the work left is in documentation, code cleanup, debugging, and adding a few features here and there. I am of course willing to accept help if anyone wants to spend the time to learn my code - as this is one of my first projects of this size & quality, it would be interesting to get feedback from someone more experienced.

    Thanks for reading, Let me know what you think!
    --Peter
      • 22980
      • 84 Posts
      bump... I’m surprised there’s no interest in a super-useful plugin like this one that allows MODx to go from serving what is basically static content in to providing big beautiful databases of data O.o
        • 12236
        • 48 Posts
        Digital Butter - MODX Premiere Partners Reply #3, 16 years, 5 months ago
        That sounds great to me - in the past I’ve added this kind of functionality, but in a messy, ad-hoc manner that hasn’t proven reusable yet. I’d love to see how you’ve gone about doing it.
          • 25663 MODX Staff
          • 12,272 Posts
          I think it’s a fantastic idea as well. Please keep up the killer work! I think AjaxSearch will work swimmingly with this as well so it may make sense to coordinate with coroico to make sure that’s smoothly handled. Finally, you might want to look at yama’s suggestion for "managing 1000s of pages" in the resource tree here for a similar approach, but using documents and TVs
            Ryan Thrash, MODX Co-Founder
            Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
            • 22980
            • 84 Posts
            Alright. So this is probably the biggest project I’ve coded, much less been the sole proprietor of. I started it because I needed the functionality for a big project and it has proven invaluable in that. However, with deadlines around and the weeks being busy as they are, its currently in a state of 90% or so good reusable code and 10% customizations hardcoded because I just needed something that worked fast. There are a number features that could be expanded and grown to make it usable in many more cases, and I realize after writing all this that I should have used an MVC but didn’t - instead my model is clunkily serialized and passed though GETs and POSTs whenever its needed.

            That being said, there is a while lot of good and expandable code in this project. I’ve never contributed to anything open source before (although I’ve been really wanting to, as I’ve been using open source software since I began using computers,) so I’m not entirely sure where to go from here. Maybe I could send this all to one or two more experienced developers who could look at it, tell me how good it is, how reasonable it is to learn, if they’re interested in continuing work on it, and what step 2 is?

            Thoughts? Interest? Questions?
              • 28042 ☆ A M B ☆
              • 24,524 Posts
              Open up a Google Code account for it, and post the links to it here.
                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
                • 19849
                • 19 Posts
                Sounds cool - thanks for posting that. I don’t have the necessary coding skill to contribute but definitely sounds interesting.

                With regard to Revolution then it seems this sort of integration will be much easier in any case? My understanding is that xPDO will make it much easier to work with custom data structures and even a visual DB editor is in the works? I’ve not yet build a site in Revolution so I’m just picking up what’s in the documentation here...
                  • 21257 MODX Staff
                  • 730 Posts
                  or GitHub as an alternative to Google Code
                  This sounds like a cool thing.
                    Mike Schell
                    Lead Developer, MODX Cloud
                    Email: [email protected]
                    GitHub: https://github.com/netProphET/
                    Twitter: @mkschell
                    • 20413
                    • 2,877 Posts
                    Cool stuff! cool
                      @hawproductions | http://mrhaw.com/

                      Infograph: MODX Advanced Install in 7 steps:
                      http://forums.modx.com/thread/96954/infograph-modx-advanced-install-in-7-steps

                      Recap: Portland, OR (PDX) MODX CMS Meetup, Oct 6, 2015. US Bancorp Tower
                      http://mrhaw.com/modx_portland_oregon_pdx_modx_cms_meetup_oct_2015_us_bancorp_tower
                      • 22980
                      • 84 Posts
                      Alright, Google Code set up!

                      https://code.google.com/p/datafrolic/

                      No offense to github or anything, I just started with this first..

                      Please have a look-see everyone! Comments & enthusiasm are welcome