We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 30176
    • 99 Posts
    Hi, I would like to incorporate a script that I have been using for some time into Modx. It is a Php Datagrid from PHP Builder. http://phpbuilder.blogspot.com/ I have set it up in an iframe but I would prefer to incorporate it more closely into Modx. Also preferably using an additional table on the Modx database. Is there what you might term a "best practices" to do this? And a little outline would be helpful to get me started. Are there elements of this database being searchable that come into consideration?

    Thank you!
      "Remember what Bilbo used to say: It's a dangerous business, Frodo, going out your door. You step onto the road, and if you don't keep your feet, there's no knowing where you might be swept off to."
      -J.R.R. Tolkien from The Lord of the Rings
      • 26931
      • 2,314 Posts
      hi tmcleroy,

      don’t know about "best practice", but this would be one approach:
      http://modxcms.com/forums/index.php/topic,44426.msg266285.html#msg266285
      http://modxcms.com/forums/index.php/topic,44506
      dbedit module also let’s you import a csv file

      ...there’s also "fast_content_csv_v09" http://modxcms.com/forums/index.php/topic,29616.0.html

      AjaxSearch is able to search custom db tables:
      http://modxcms.com/forums/index.php?topic=27316.0
      AjaxSearch
      http://modxcms.com/forums/index.php/board,320.0.html

      hope i could help smiley
        • 30176
        • 99 Posts
        Thank you Sharkbait,

        I took some time today to study the links you gave me. It provided a very good background and I follow what they are doing. I, however, want to branch out in a little different direction. I guess the basic question, within Modx is there a way to just drop code into the framework and have it run without having to rewrite it(or with very minimal change). Here is some examples of what it can do and so that you can see why someone might like to use this code. It has ajax capability along with a very mature script.
        http://www.apphp.com/php-datagrid/index.php?page=examples

        I want to run this in the front end. As I am trying to learn Modx, I am seeing that most everything is parsed through the Modx API. If the script is possible to run great. If not, this shows my limited understanding, but, is there an option to go around the Modx API for some content and yet still fit within the framework? Does this make sense? I am not going to have limitations on who sees the data as it will be public to all users.

        I have 2000+ companies that would reside in this database and the search functions are really nice with this script. I can then call data from this table back into other Modx pages as need be. The capabilities of this script besides being beyond me would take a long time to replicate. I currently use the script myself for another application with several thousand records and it runs very nicely.

        Thank you.
          "Remember what Bilbo used to say: It's a dangerous business, Frodo, going out your door. You step onto the road, and if you don't keep your feet, there's no knowing where you might be swept off to."
          -J.R.R. Tolkien from The Lord of the Rings
          • 26931
          • 2,314 Posts
          hi tmcleroy,

          if you want it to run as standalone app, you could easily create a module with one line of code http://modxcms.com/forums/index.php?topic=42971.0 and display it on your frontend in an iframe ... that would be the fastest and easiest way.

          don’t know if page scrape would work for displaying it would work in your case:
          http://papermashup.com/use-jquery-and-php-to-scrape-page-content/

          or try php include instead of iframes
          http://www.ozzu.com/html-tutorials/tutorial-use-php-include-work-like-frame-t86711.html
            • 28042 ☆ A M B ☆
            • 24,524 Posts
            MODx runs snippets via the PHP eval() function. Sometimes this can cause unexpected results when using external code.

            If you’re accessing a separate database, you need to be aware that MODx has to be able to access its own database, so any connections your external code opened to its database have to be properly closed.
              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
              • 14152
              • 3 Posts

              Have you tried phpgrid from phpgrid.com? It works out well for me.
                • 30176
                • 99 Posts
                Hi, Thank you. Can you relate a little about how you incorporated it. Is it in an iframe or did you incorporate the code?
                  "Remember what Bilbo used to say: It's a dangerous business, Frodo, going out your door. You step onto the road, and if you don't keep your feet, there's no knowing where you might be swept off to."
                  -J.R.R. Tolkien from The Lord of the Rings
                  • 15083
                  • 697 Posts
                  Hi there,

                  I use this one: http://www.flexigrid.info/
                  It uses JQuery, and to make it DB driven I use snippet calls in MODx to return the relevant json.
                  Put a snippet on a page (with no template) and the grid pulls back everything it needs from your snippet.

                  Works a treat, AJAX is great smiley

                  J
                    • 30176
                    • 99 Posts
                    Thank you...it looks great.
                      "Remember what Bilbo used to say: It's a dangerous business, Frodo, going out your door. You step onto the road, and if you don't keep your feet, there's no knowing where you might be swept off to."
                      -J.R.R. Tolkien from The Lord of the Rings
                      • 4971
                      • 964 Posts
                      @jusmaig: does flexigrid degrades ok for people with jsp disabled?
                        Website: www.mercologia.com
                        MODX Revo Tutorials:  www.modxperience.com

                        MODX Professional Partner