We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 5894
    • 10 Posts
    I have a table of data that exists in the same database as my modx tables.

    This table is the source for various listed and tabulated data around various parts of the website, so it makes sense to have the data editable within the ModX manager.

    So I would like to add, within the ModX interface, the simple ability to perform basic CRUD operations on this table when logged in.

    How would I go about doing this? I have the rest of the site working well and have incoporated wayfinder, maxigallery and eform in to various aspects. But really, Im very new to ModX and for this task I dont know where to start.

    Many thanks
      • 5894
      • 10 Posts
      Thanks for the tips. I’ll have a crack at that today.
        • 28042 ☆ A M B ☆
        • 24,524 Posts
        I’ve got a tutorial and demo of a database management module on my site. See my sig for guest login details.
          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
          • 4002
          • 64 Posts
          if you want to use this, i have modified the MySQL TableEditor code to manage a custom table in modx. This zip file includes all required pear libraries and modifies the record-paging header to align to the left so that the controls appear within the screen (one limitation to this code is that you have to have all the fields displayed in order for them to be included in the downloadable .csv - which was crucial for my purposes - so the screen scrolled to the right with all the fields activated).

          also, you have to call this from an iframe within the module window to avoid the ’id=0’ error.

          Instructions:
          1. Save this code the following directory: /assets/modules/custom_contacts/
          2. Modify the config file with your database/table/user values
          3. Create a new module and enter the following code:
          echo "<iframe src=’/assets/modules/custom_contacts/dsp_contacts.php’ style=’height:100%;width:100%;border:0px’ ALLOWTRANSPARENCY=’true’ frameborder=’0’></iframe>";

          You should be set with a fully-functional CRUD interface with your table.