We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 10597
    • 31 Posts
    I've been through many tutorials on setting up CMP pages in Revo. Including the updated one for CMP tutorial for 2.3.

    I am now at a point that puts me closer than I have ever been on figuring out how to create a CMP with a custom table.
    I have everything setup using MIGxDB 2.8.1. The only thing I can't get to work is the loading of the database table on the created CMP page. It will save to the correct table when I add a new item using that page but will not load the data to list it in the grid.

    Can anyone give me some insight on why MIGxDB will not load the data that it clearly can put in the table?

    Nothing in any logs are pointing me to any issues.

    Thanks

    This question has been answered by multiple community members. See the first response.

    [ed. note: geeble last edited this post 12 years, 2 months ago.]
      Using ModX Revolution
      • 4172
      • 5,888 Posts
      We allways need to see:

      your MIGX - configuration (the exported json) and your xpdo-schema.
        -------------------------------

        you can buy me a beer, if you like MIGX

        http://webcmsolutions.de/migx.html

        Thanks!
        • 10597
        • 31 Posts
        Bruno,

        I hope this helps. I'm at a complete loss at what to do next.

        Thanks!

        schema:
        <?xml version="1.0" encoding="UTF-8"?>
        <model package="zoommap" baseClass="xPDOObject" platform="mysql" defaultEngine="MyISAM">
            <object class="ZoomMap" table="zoommap" extends="xPDOSimpleObject">
                <field key="id" dbtype="bigint" precision="20" phptype="integer" null="false" index="pk"  generated="native"/>
                <field key="name" dbtype="varchar" precision="64" phptype="string" null="false" default=""/>
                <field key="lat" dbtype="varchar" precision="24" phptype="string" default=""/>
                <field key="lon" dbtype="varchar" precision="24" phptype="string" default=""/>
                <field key="radius" dbtype="int" precision="3" attributes="unsigned" phptype="integer" default="4" />
                <field key="color" dbtype="varchar" precision="12" phptype="string" default=""/>
                <field key="info" dbtype="varchar" precision="255" phptype="string" default=""/>
                <field key="link" dbtype="varchar" precision="255" phptype="string" default=""/>
                <field key="anchor" dbtype="text" phptype="string" default=""/>
                <field key="state" dbtype="varchar" precision="64" phptype="string" default=""/>
                <field key="country" dbtype="varchar" precision="4" phptype="string" default=""/>
                <field key="deleted" dbtype="tinyint" precision="1" attributes="unsigned" phptype="integer" default="0" />
                <field key="published" dbtype="tinyint" precision="1" attributes="unsigned" phptype="integer" default="1" />
            </object>
        </model>


        json:
        {
          "formtabs":[
            {
              "MIGX_id":3,
              "caption":"Location",
              "print_before_tabs":"0",
              "fields":[
                {
                  "MIGX_id":5,
                  "field":"name",
                  "caption":"Name",
                  "description":"",
                  "description_is_code":"0",
                  "inputTV":"",
                  "inputTVtype":"",
                  "validation":"",
                  "configs":"",
                  "restrictive_condition":"",
                  "display":"",
                  "sourceFrom":"config",
                  "sources":"",
                  "inputOptionValues":"",
                  "default":"",
                  "pos":1
                },
                {
                  "MIGX_id":6,
                  "field":"lat",
                  "caption":"Latitude",
                  "description":"",
                  "description_is_code":"0",
                  "inputTV":"",
                  "inputTVtype":"",
                  "validation":"",
                  "configs":"",
                  "restrictive_condition":"",
                  "display":"",
                  "sourceFrom":"config",
                  "sources":"",
                  "inputOptionValues":"",
                  "default":"",
                  "pos":2
                },
                {
                  "MIGX_id":7,
                  "field":"lon",
                  "caption":"Longitude",
                  "description":"",
                  "description_is_code":"0",
                  "inputTV":"",
                  "inputTVtype":"",
                  "validation":"",
                  "configs":"",
                  "restrictive_condition":"",
                  "display":"",
                  "sourceFrom":"config",
                  "sources":"",
                  "inputOptionValues":"",
                  "default":"",
                  "pos":3
                }
              ],
              "pos":1
            }
          ],
          "contextmenus":"update||duplicate||recall_remove_delete",
          "actionbuttons":"addItem||bulk",
          "columnbuttons":"update||remove",
          "filters":"",
          "extended":{
            "migx_add":"Add Location",
            "disable_add_item":"",
            "formcaption":"",
            "update_win_title":"",
            "win_id":"zoommap",
            "maxRecords":"",
            "addNewItemAt":"bottom",
            "multiple_formtabs":"",
            "actionbuttonsperrow":4,
            "winbuttonslist":"",
            "extrahandlers":"this.remove",
            "filtersperrow":4,
            "packageName":"zoommap",
            "classname":"zoommap",
            "task":"",
            "getlistsort":"",
            "getlistsortdir":"",
            "sortconfig":"",
            "gridpagesize":50,
            "use_custom_prefix":"0",
            "prefix":"",
            "grid":"",
            "gridload_mode":1,
            "check_resid":1,
            "check_resid_TV":"",
            "join_alias":"",
            "has_jointable":"yes",
            "getlistwhere":"",
            "joins":"",
            "cmpmaincaption":"Zoom Map",
            "cmptabcaption":"Locations",
            "cmptabdescription":"Manage your map locations here. You can edit them by either double-clicking on the grid or right-clicking on the respective row.",
            "cmptabcontroller":"",
            "winbuttons":"",
            "onsubmitsuccess":"",
            "submitparams":""
          },
          "columns":[
            {
              "MIGX_id":1,
              "header":"ID",
              "dataIndex":"id",
              "width":"",
              "sortable":"false",
              "show_in_grid":1,
              "renderer":"",
              "clickaction":"",
              "selectorconfig":"",
              "renderchunktpl":"",
              "renderoptions":""
            },
            {
              "MIGX_id":2,
              "header":"Name",
              "dataIndex":"name",
              "width":"",
              "sortable":"false",
              "show_in_grid":1,
              "renderer":"",
              "clickaction":"",
              "selectorconfig":"",
              "renderchunktpl":"",
              "renderoptions":""
            },
            {
              "MIGX_id":3,
              "header":"Latitude",
              "dataIndex":"lat",
              "width":"",
              "sortable":"false",
              "show_in_grid":1,
              "renderer":"",
              "clickaction":"",
              "selectorconfig":"",
              "renderchunktpl":"",
              "renderoptions":""
            },
            {
              "MIGX_id":4,
              "header":"Longitude",
              "dataIndex":"lon",
              "width":"",
              "sortable":"false",
              "show_in_grid":1,
              "renderer":"",
              "clickaction":"",
              "selectorconfig":"",
              "renderchunktpl":"",
              "renderoptions":""
            },
            {
              "MIGX_id":5,
              "header":"Radius",
              "dataIndex":"radius",
              "width":"",
              "sortable":"false",
              "show_in_grid":1,
              "renderer":"",
              "clickaction":"",
              "selectorconfig":"",
              "renderchunktpl":"",
              "renderoptions":""
            },
            {
              "MIGX_id":6,
              "header":"Color",
              "dataIndex":"color",
              "width":"",
              "sortable":"false",
              "show_in_grid":1,
              "renderer":"",
              "clickaction":"",
              "selectorconfig":"",
              "renderchunktpl":"",
              "renderoptions":""
            },
            {
              "MIGX_id":7,
              "header":"Info",
              "dataIndex":"info",
              "width":"",
              "sortable":"false",
              "show_in_grid":1,
              "renderer":"",
              "clickaction":"",
              "selectorconfig":"",
              "renderchunktpl":"",
              "renderoptions":""
            },
            {
              "MIGX_id":8,
              "header":"Link",
              "dataIndex":"link",
              "width":"",
              "sortable":"false",
              "show_in_grid":1,
              "renderer":"",
              "clickaction":"",
              "selectorconfig":"",
              "renderchunktpl":"",
              "renderoptions":""
            },
            {
              "MIGX_id":9,
              "header":"Anchor",
              "dataIndex":"anchor",
              "width":"",
              "sortable":"false",
              "show_in_grid":1,
              "renderer":"",
              "clickaction":"",
              "selectorconfig":"",
              "renderchunktpl":"",
              "renderoptions":""
            },
            {
              "MIGX_id":10,
              "header":"State",
              "dataIndex":"state",
              "width":"",
              "sortable":"false",
              "show_in_grid":1,
              "renderer":"",
              "clickaction":"",
              "selectorconfig":"",
              "renderchunktpl":"",
              "renderoptions":""
            },
            {
              "MIGX_id":11,
              "header":"Country",
              "dataIndex":"country",
              "width":"",
              "sortable":"false",
              "show_in_grid":"0",
              "renderer":"",
              "clickaction":"",
              "selectorconfig":"",
              "renderchunktpl":"",
              "renderoptions":""
            },
            {
              "MIGX_id":12,
              "header":"deleted",
              "dataIndex":"deleted",
              "width":"",
              "sortable":"false",
              "show_in_grid":"0",
              "renderer":"",
              "clickaction":"",
              "selectorconfig":"",
              "renderchunktpl":"",
              "renderoptions":""
            }
          ]
        }
          Using ModX Revolution
        • discuss.answer
          • 4172
          • 5,888 Posts
          the primary-key-field id is automatically added by xpdo, when extending xPDOSimpleObject

          you should try without id:

          <?xml version="1.0" encoding="UTF-8"?>
          <model package="zoommap" baseClass="xPDOObject" platform="mysql" defaultEngine="MyISAM">
              <object class="ZoomMap" table="zoommap" extends="xPDOSimpleObject">
                  <field key="name" dbtype="varchar" precision="64" phptype="string" null="false" default=""/>
                  <field key="lat" dbtype="varchar" precision="24" phptype="string" default=""/>
                  <field key="lon" dbtype="varchar" precision="24" phptype="string" default=""/>
                  <field key="radius" dbtype="int" precision="3" attributes="unsigned" phptype="integer" default="4" />
                  <field key="color" dbtype="varchar" precision="12" phptype="string" default=""/>
                  <field key="info" dbtype="varchar" precision="255" phptype="string" default=""/>
                  <field key="link" dbtype="varchar" precision="255" phptype="string" default=""/>
                  <field key="anchor" dbtype="text" phptype="string" default=""/>
                  <field key="state" dbtype="varchar" precision="64" phptype="string" default=""/>
                  <field key="country" dbtype="varchar" precision="4" phptype="string" default=""/>
                  <field key="deleted" dbtype="tinyint" precision="1" attributes="unsigned" phptype="integer" default="0" />
                  <field key="published" dbtype="tinyint" precision="1" attributes="unsigned" phptype="integer" default="1" />
              </object>
          </model>


          and your classname is 'ZoomMap'
          but you have 'zoommap' in your MIGXdb - setting
            -------------------------------

            you can buy me a beer, if you like MIGX

            http://webcmsolutions.de/migx.html

            Thanks!
            • 10597
            • 31 Posts
            Excellent! Thank you!!!
            Beer on the way!
              Using ModX Revolution
            • discuss.answer
              • 10597
              • 31 Posts
              Here is what I have done for this little project. The whole purpose was to create a location point manager for an HTML5 map. I am using this map here http://www.fla-shop.com/products/html5-zoom/united-states/us/ It could apply to many other maps with a little modification or many other things with a similar setup. I already have several other ideas for it.


              MigX config:
              {
                "formtabs":[
                  {
                    "MIGX_id":3,
                    "caption":"Locations",
                    "print_before_tabs":"0",
                    "fields":[
                      {
                        "MIGX_id":5,
                        "field":"name",
                        "caption":"City",
                        "description":"",
                        "description_is_code":"0",
                        "inputTV":"",
                        "inputTVtype":"",
                        "validation":"",
                        "configs":"",
                        "restrictive_condition":"",
                        "display":"",
                        "sourceFrom":"config",
                        "sources":"",
                        "inputOptionValues":"",
                        "default":"",
                        "pos":1
                      },
                      {
                        "MIGX_id":6,
                        "field":"lat",
                        "caption":"Latitude",
                        "description":"",
                        "description_is_code":"0",
                        "inputTV":"",
                        "inputTVtype":"",
                        "validation":"",
                        "configs":"",
                        "restrictive_condition":"",
                        "display":"",
                        "sourceFrom":"config",
                        "sources":"",
                        "inputOptionValues":"",
                        "default":"",
                        "pos":2
                      },
                      {
                        "MIGX_id":7,
                        "field":"lon",
                        "caption":"Longitude",
                        "description":"",
                        "description_is_code":"0",
                        "inputTV":"",
                        "inputTVtype":"",
                        "validation":"",
                        "configs":"",
                        "restrictive_condition":"",
                        "display":"",
                        "sourceFrom":"config",
                        "sources":"",
                        "inputOptionValues":"",
                        "default":"",
                        "pos":3
                      },
                      {
                        "MIGX_id":8,
                        "field":"radius",
                        "caption":"Radius",
                        "description":"",
                        "description_is_code":"0",
                        "inputTV":"",
                        "inputTVtype":"",
                        "validation":"",
                        "configs":"",
                        "restrictive_condition":"",
                        "display":"",
                        "sourceFrom":"config",
                        "sources":"",
                        "inputOptionValues":"",
                        "default":4,
                        "pos":4
                      },
                      {
                        "MIGX_id":9,
                        "field":"color",
                        "caption":"Color",
                        "description":"Color of dot on map",
                        "description_is_code":"0",
                        "inputTV":"",
                        "inputTVtype":"",
                        "validation":"",
                        "configs":"",
                        "restrictive_condition":"",
                        "display":"",
                        "sourceFrom":"config",
                        "sources":"",
                        "inputOptionValues":"",
                        "default":"#FF0000",
                        "pos":5
                      },
                      {
                        "MIGX_id":10,
                        "field":"info",
                        "caption":"Info",
                        "description":"Information",
                        "description_is_code":"0",
                        "inputTV":"",
                        "inputTVtype":"",
                        "validation":"",
                        "configs":"",
                        "restrictive_condition":"",
                        "display":"",
                        "sourceFrom":"config",
                        "sources":"",
                        "inputOptionValues":"",
                        "default":"",
                        "pos":6
                      },
                      {
                        "MIGX_id":11,
                        "field":"link",
                        "caption":"Link",
                        "description":"",
                        "description_is_code":"0",
                        "inputTV":"",
                        "inputTVtype":"",
                        "validation":"",
                        "configs":"",
                        "restrictive_condition":"",
                        "display":"",
                        "sourceFrom":"config",
                        "sources":"",
                        "inputOptionValues":"",
                        "default":"",
                        "pos":7
                      },
                      {
                        "MIGX_id":12,
                        "field":"anchor",
                        "caption":"Anchor",
                        "description":"",
                        "description_is_code":"0",
                        "inputTV":"",
                        "inputTVtype":"",
                        "validation":"",
                        "configs":"",
                        "restrictive_condition":"",
                        "display":"",
                        "sourceFrom":"config",
                        "sources":"",
                        "inputOptionValues":"Left==left||Right==right",
                        "default":"",
                        "pos":8
                      },
                      {
                        "MIGX_id":13,
                        "field":"state",
                        "caption":"State",
                        "description":"",
                        "description_is_code":"0",
                        "inputTV":"",
                        "inputTVtype":"",
                        "validation":"",
                        "configs":"",
                        "restrictive_condition":"",
                        "display":"",
                        "sourceFrom":"config",
                        "sources":"",
                        "inputOptionValues":"",
                        "default":"",
                        "pos":9
                      },
                      {
                        "MIGX_id":14,
                        "field":"country",
                        "caption":"Country",
                        "description":"",
                        "description_is_code":"0",
                        "inputTV":"",
                        "inputTVtype":"",
                        "validation":"",
                        "configs":"",
                        "restrictive_condition":"",
                        "display":"",
                        "sourceFrom":"config",
                        "sources":"",
                        "inputOptionValues":"",
                        "default":"",
                        "pos":10
                      }
                    ],
                    "pos":1
                  }
                ],
                "contextmenus":"update||duplicate||recall_remove_delete",
                "actionbuttons":"addItem||bulk",
                "columnbuttons":"update||remove",
                "filters":"",
                "extended":{
                  "migx_add":"Add Location",
                  "disable_add_item":"",
                  "formcaption":"Zoom Map Location",
                  "update_win_title":"Zoom Map",
                  "win_id":"zoommap",
                  "maxRecords":"",
                  "addNewItemAt":"bottom",
                  "multiple_formtabs":"",
                  "actionbuttonsperrow":4,
                  "winbuttonslist":"",
                  "extrahandlers":"this.remove",
                  "filtersperrow":4,
                  "packageName":"zoommap",
                  "classname":"ZoomMap",
                  "task":"",
                  "getlistsort":"",
                  "getlistsortdir":"",
                  "sortconfig":"",
                  "gridpagesize":50,
                  "use_custom_prefix":"0",
                  "prefix":"",
                  "grid":"",
                  "gridload_mode":1,
                  "check_resid":1,
                  "check_resid_TV":"",
                  "join_alias":"",
                  "has_jointable":"yes",
                  "getlistwhere":"",
                  "joins":"",
                  "cmpmaincaption":"Zoom Map",
                  "cmptabcaption":"Locations",
                  "cmptabdescription":"Manage your map locations here. You can edit them by either double-clicking on the grid or right-clicking on the respective row.",
                  "cmptabcontroller":"",
                  "winbuttons":"",
                  "onsubmitsuccess":"",
                  "submitparams":""
                },
                "columns":[
                  {
                    "MIGX_id":1,
                    "header":"ID",
                    "dataIndex":"id",
                    "width":"",
                    "sortable":"false",
                    "show_in_grid":1,
                    "renderer":"",
                    "clickaction":"",
                    "selectorconfig":"",
                    "renderchunktpl":"",
                    "renderoptions":""
                  },
                  {
                    "MIGX_id":2,
                    "header":"Name",
                    "dataIndex":"name",
                    "width":"",
                    "sortable":true,
                    "show_in_grid":1,
                    "renderer":"",
                    "clickaction":"",
                    "selectorconfig":"",
                    "renderchunktpl":"",
                    "renderoptions":""
                  },
                  {
                    "MIGX_id":3,
                    "header":"Latitude",
                    "dataIndex":"lat",
                    "width":"",
                    "sortable":"false",
                    "show_in_grid":1,
                    "renderer":"",
                    "clickaction":"",
                    "selectorconfig":"",
                    "renderchunktpl":"",
                    "renderoptions":""
                  },
                  {
                    "MIGX_id":4,
                    "header":"Longitude",
                    "dataIndex":"lon",
                    "width":"",
                    "sortable":"false",
                    "show_in_grid":1,
                    "renderer":"",
                    "clickaction":"",
                    "selectorconfig":"",
                    "renderchunktpl":"",
                    "renderoptions":""
                  },
                  {
                    "MIGX_id":5,
                    "header":"Radius",
                    "dataIndex":"radius",
                    "width":"",
                    "sortable":true,
                    "show_in_grid":1,
                    "renderer":"",
                    "clickaction":"",
                    "selectorconfig":"",
                    "renderchunktpl":"",
                    "renderoptions":""
                  },
                  {
                    "MIGX_id":6,
                    "header":"Color",
                    "dataIndex":"color",
                    "width":"",
                    "sortable":true,
                    "show_in_grid":1,
                    "renderer":"",
                    "clickaction":"",
                    "selectorconfig":"",
                    "renderchunktpl":"",
                    "renderoptions":""
                  },
                  {
                    "MIGX_id":7,
                    "header":"Info",
                    "dataIndex":"info",
                    "width":"",
                    "sortable":"false",
                    "show_in_grid":1,
                    "renderer":"",
                    "clickaction":"",
                    "selectorconfig":"",
                    "renderchunktpl":"",
                    "renderoptions":""
                  },
                  {
                    "MIGX_id":8,
                    "header":"Link",
                    "dataIndex":"link",
                    "width":"",
                    "sortable":"false",
                    "show_in_grid":1,
                    "renderer":"",
                    "clickaction":"",
                    "selectorconfig":"",
                    "renderchunktpl":"",
                    "renderoptions":""
                  },
                  {
                    "MIGX_id":9,
                    "header":"Anchor",
                    "dataIndex":"anchor",
                    "width":"",
                    "sortable":"false",
                    "show_in_grid":1,
                    "renderer":"",
                    "clickaction":"",
                    "selectorconfig":"",
                    "renderchunktpl":"",
                    "renderoptions":""
                  },
                  {
                    "MIGX_id":10,
                    "header":"State",
                    "dataIndex":"state",
                    "width":"",
                    "sortable":true,
                    "show_in_grid":1,
                    "renderer":"",
                    "clickaction":"",
                    "selectorconfig":"",
                    "renderchunktpl":"",
                    "renderoptions":""
                  },
                  {
                    "MIGX_id":11,
                    "header":"Country",
                    "dataIndex":"country",
                    "width":"",
                    "sortable":true,
                    "show_in_grid":"0",
                    "renderer":"",
                    "clickaction":"",
                    "selectorconfig":"",
                    "renderchunktpl":"",
                    "renderoptions":""
                  },
                  {
                    "MIGX_id":12,
                    "header":"deleted",
                    "dataIndex":"deleted",
                    "width":"",
                    "sortable":"false",
                    "show_in_grid":"0",
                    "renderer":"",
                    "clickaction":"",
                    "selectorconfig":"",
                    "renderchunktpl":"",
                    "renderoptions":""
                  }
                ]
              }



              XPDO schema:
              <?xml version="1.0" encoding="UTF-8"?>
              <model package="zoommap" baseClass="xPDOObject" platform="mysql" defaultEngine="MyISAM">
                  <object class="ZoomMap" table="zoommap" extends="xPDOSimpleObject">
                      <field key="name" dbtype="varchar" precision="64" phptype="string" null="false" default=""/>
                      <field key="lat" dbtype="varchar" precision="24" phptype="string" default=""/>
                      <field key="lon" dbtype="varchar" precision="24" phptype="string" default=""/>
                      <field key="radius" dbtype="int" precision="3" attributes="unsigned" phptype="integer" default="4" />
                      <field key="color" dbtype="varchar" precision="12" phptype="string" default=""/>
                      <field key="info" dbtype="varchar" precision="255" phptype="string" default=""/>
                      <field key="link" dbtype="varchar" precision="255" phptype="string" default=""/>
                      <field key="anchor" dbtype="text" phptype="string" default=""/>
                      <field key="state" dbtype="varchar" precision="64" phptype="string" default=""/>
                      <field key="country" dbtype="varchar" precision="4" phptype="string" default=""/>
                      <field key="deleted" dbtype="tinyint" precision="1" attributes="unsigned" phptype="integer" default="0" />
                      <field key="published" dbtype="tinyint" precision="1" attributes="unsigned" phptype="integer" default="1" />
                  </object>
              </model>
              


              Snippet to export config data to Zoom Map via a Resource document:
              /**
               * @snippet mappoints
               */
              $base_path = !empty($base_path) ? $base_path : $modx->getOption('core_path').'components/zoommap/';
              
              $modx->addPackage('zoommap',$base_path.'model/');
              
              $points = $modx->getCollection('ZoomMap');
              $fields = $modx->getFields('ZoomMap');
              $fields = array_keys($fields);
              echo implode("\t", $fields) . "\n";
              foreach($points as $point){
                 // Gotta be a better way to get the array of values than this!!!
                 foreach($fields as $field){
                    $values[]=$point->get($field);
                 }
                 // Oh Well, moving on!
                 if($point->get('deleted') != 1 && $point->get('published') == 1){
                    echo implode("\t", $values) . "\n";
                 }
                 $values = array();
              }
              



              Setup a resource calling the snippet
              Update the configs for the Zoom Map using its install directions


              There was a lot of quirks I had to overcome. Tutorials giving wrong information for 2.3.

              • where to put CMP action
              • how to call migx to load the new CMP
              • classname and package name cannot be the same (some tuts were, others weren't. Confusing!)

              Bruno, The first round of Create the Configuration appears to be unneeded in this tutorial and threw me for a loop.
              http://rtfm.modx.com/extras/revo/migxdb/migxdb.tutorials/migxdb.create-doodles-manager-with-help-of-migxdb


              Adding the CMP action for Modx 2.3:
              System Settings (gear icon on top right) -> Menus -> Create Menu:
              Namespace: migx
              Action: index
              Parameters: &configs=zoommap





              I hope this helps someone else.


              Again Bruno, thank you very much for MigX, the tutorials and your help getting me unstuck with the id column and classnames. [ed. note: geeble last edited this post 12 years, 2 months ago.]
                Using ModX Revolution
                • 4172
                • 5,888 Posts
                some improvements - untested:

                <?php
                
                /**
                 * @snippet mappoints
                 */
                $base_path = !empty($base_path) ? $base_path : $modx->getOption('core_path') . 'components/zoommap/';
                
                $modx->addPackage('zoommap', $base_path . 'model/');
                
                $classname = 'ZoomMap';
                $output = '';
                
                $c = $modx->newQuery($classname);
                $c->where(array('deleted:!=' => '1','published'=>'1'));
                
                if ($collection = $modx->getCollection($classname)) {
                    $fields = $modx->getFields($classname);
                    $fields = array_keys($fields);
                    $output = implode("\t", $fields) . "\n";
                    foreach ($collection as $object) {
                        $values = $object->toArray();
                        $output .= implode("\t", $values) . "\n";
                    }
                }
                
                return $output;
                
                
                [ed. note: Bruno17 last edited this post 12 years, 2 months ago.]
                  -------------------------------

                  you can buy me a beer, if you like MIGX

                  http://webcmsolutions.de/migx.html

                  Thanks!
                  • 10597
                  • 31 Posts
                  Thank you!

                  Works perfect and faster!
                    Using ModX Revolution